Skip to content

Instantly share code, notes, and snippets.

@porras
Created August 19, 2014 07:59
Show Gist options
  • Save porras/5d4010a254635cedbb6e to your computer and use it in GitHub Desktop.
Save porras/5d4010a254635cedbb6e to your computer and use it in GitHub Desktop.
Fun with dates
>> require 'date'
=> true
>> Date.today.next_month
=> #<Date: 2014-09-19 (4913839/2,0,2299161)>
>> Date.today.next_month - 1
=> #<Date: 2014-09-18 (4913837/2,0,2299161)>
>> Date.today.next_month -1
=> #<Date: 2014-07-19 (4913715/2,0,2299161)>
@eljojo
Copy link

eljojo commented Aug 19, 2014

funny thing, Date.today.next_month-1 also does the job correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment