Created
June 18, 2010 18:17
-
-
Save ferblape/444000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imaginad que hoy es 31 de mayo. ¿"1 month ago" tendría que ser 30 de abril o 1 de mayo? | |
# Rails: 30 de abril | |
>> t = Time.local 2010,05,31 | |
=> lun may 31 00:00:00 -0400 2010 | |
>> t - 1.month | |
=> vie abr 30 00:00:00 -0400 2010 | |
>> t = Time.local 2010,05,30 | |
=> dom may 30 00:00:00 -0400 2010 | |
>> t - 1.month | |
=> vie abr 30 00:00:00 -0400 2010 | |
# Chronic: 1 de mayo | |
>> require 'chronic' | |
>> Chronic.parse("1 month ago", :now => Time.local(2010,05,31)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment