Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion to add a new method: add_days #65

Open
gugod opened this issue Nov 21, 2023 · 0 comments
Open

Suggestion to add a new method: add_days #65

gugod opened this issue Nov 21, 2023 · 0 comments

Comments

@gugod
Copy link
Contributor

gugod commented Nov 21, 2023

I often need to do some simple datetime calculation in test code to create a timestamp in the past, and that's when it became a bit inconsistent, because to refer to a timestamp about a month ago, we could do:

Time::Piece->new()->add_months(-1)

But for 1 day ago, we must do:

Time:::Piece->new() - ONE_DAY

It would seem intuitive to me that there ought to be an add_days method, but no.

Sometimes I need to append an ->strftime() after making a past timestamps. Being able to "time travel" with a method call do help making it look better and easier to write.

Are we up for adding these two methods ?

@gugod gugod changed the title Suggestion to add new methods: add_days and add_years Suggestion to add new methods: add_days Nov 21, 2023
@gugod gugod changed the title Suggestion to add new methods: add_days Suggestion to add a new method: add_days Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant