You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ?
The text was updated successfully, but these errors were encountered:
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
changed the title
Suggestion to add new methods: add_days
Suggestion to add a new method: add_days
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:
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 ?
The text was updated successfully, but these errors were encountered: