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
When i'm trying to calculate months between given date its not showing proper result for an exact year calculation.
irb(main):013:0> start_time = Time.now.beginning_of_year
=> 2015-01-01 00:00:00 +0530
irb(main):014:0> end_time = Time.now.end_of_year
=> 2015-12-31 23:59:59 +0530
For the above given value i expect result as 12 months OR 12 months, 30 days, 23 hours and so on.
irb(main):015:0> DOTIW::TimeHash.new(nil, Time.now.beginning_of_year, Time.now.end_of_year, {}).to_hash
=> {:years=>0, :months=>11, :days=>30}
If i reduce 1 day from end time, it shows proper answer.
irb(main):016:0> DOTIW::TimeHash.new(nil, Time.now.beginning_of_year, Time.now.end_of_year-1.day, {}).to_hash
=> {:years=>0, :months=>11, :days=>29, :hours=>23, :minutes=>59, :seconds=>59}
—
Reply to this email directly or view it on GitHub.
dblock
added a commit
to dblock/distance_of_time_in_words
that referenced
this issue
Jul 2, 2020
This is still a non-feature, it would be nice if end of year minus beginning of year was smart enough to say "12 months", but seems non-trivial. Spec in dblock@74bc2cc.
When i'm trying to calculate months between given date its not showing proper result for an exact year calculation.
For the above given value i expect result as 12 months OR 12 months, 30 days, 23 hours and so on.
If i reduce 1 day from end time, it shows proper answer.
The text was updated successfully, but these errors were encountered: