Skip to content

Instantly share code, notes, and snippets.

@matsubo
Last active February 15, 2016 11:27
Show Gist options
  • Save matsubo/7b3c7fbe6e613d515158 to your computer and use it in GitHub Desktop.
Save matsubo/7b3c7fbe6e613d515158 to your computer and use it in GitHub Desktop.
require 'active_support'
require 'active_support/core_ext'
# Wrong
# 2014-04-06 00:59:59 UTC
# should be 2014-04-05 23:59:59 UTC
puts 37.days.since(Time.utc(2014, 2, 27, 23, 59, 59).in_time_zone('Wellington')).utc
# 2014-04-05 23:59:59 UTC
puts 37.days.since(Time.utc(2014, 2, 27, 23, 59, 59).in_time_zone('Wellington').utc)
# 2014-04-04 23:59:59 UTC
puts 36.days.since(Time.utc(2014, 2, 27, 23, 59, 59).in_time_zone('Wellington')).utc
# 2014-04-04 23:59:59 UTC
puts 36.days.since(Time.utc(2014, 2, 27, 23, 59, 59).in_time_zone('Wellington').utc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment