Plugins - day_questions

StarAdd to favorites

day_questions

day_questions adds helper methods for determining if a specified date/time was yesterday, today, or tomorrow.

Resources

API

Bugs

Development

Source

  • git://github.com/pluginaweek/_questions.git

Usage

Predicate methods

  >> 1.day.ago.yesterday?
  => true
  >> Time.now.today?
  => true
  >> 1.day.from_now.tomorrow?
  => true
  >> 1.day.from_now.around_today?
  => true

Date/Time formatting

In addition to the predicate methods, there also exists a helper method to output a humanized version of the current day which will return "Yesterday", "Today", "Tomorrow" or a custom date format if it is outside the range of around today. See PluginAWeek::DayQuestions::Date#human_day for more information.

Tips

With the addition of the interpolated_time_formats[http://github.com/pluginaweek/interpolated_time_formats] plugin, you can output a string version of the time/date with human_day like so:

  >> Time.now.strftime('#{human_day} at #{hour}')
  => "Today at 5"

Dependencies

None.

Aaron Pfeifer

http://github.com/pluginaweek/_questions

git://github.com/pluginaweek/_questions.git

Rails' (MIT)

  • Currently 0.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Misc. Enhancements

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?