Skip to content

Instantly share code, notes, and snippets.

@huned
Created August 3, 2012 19:42
Show Gist options
  • Select an option

  • Save huned/3250803 to your computer and use it in GitHub Desktop.

Select an option

Save huned/3250803 to your computer and use it in GitHub Desktop.
>> Timecop.freeze Time.parse('January 1, 2012')
=> 2012-01-01 00:00:00 -0800
>> Time.parse('January 1, 2011').to_s(:activity)
=> "January 2011"
>> Time.parse('February 1, 2011').to_s(:activity)
=> "February 2011"
>> Time.parse('March 1, 2011').to_s(:activity)
=> "March"
>> Time.parse('January 1, 2012').to_s(:activity)
=> "Today"
>> Time.parse('December 1, 2011').to_s(:activity)
=> "Last Month"
>> Time.parse('December 30, 2011').to_s(:activity)
=> "Friday"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment