I know there is a method to determine if a certain time is on Daylight Savings Time (Time.now.dst?
) but is there a method to give us the next date when Daylight Savings will change?
For example, Google returns Sunday, November 1
as the next Daylight Savings Time change in 2015.
Since these are dates that are based on other values, like the timezone you are working with, it requires a module like ActiveSupport/TZInfo.
One thing I haven't figured out is that since regular Ruby Core does this:
Where is it getting this info? I found the TZInfo classes through ActiveSupport. Is Ruby just getting a boolean value from the OS?
How about this extension of the Time class:
Now you can do
Time.next_dst_change
. You can apply this on your own timezone only but it solves your problem.