Project

date_misc

0.0
No commit activity in last 3 years
No release in over 3 years
add some convinient methods on Date
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
>= 0
~> 10.0
 Project Readme

DateMisc

Build Status

add misc methods to Date

Usage

require 'date_misc'

  • Date.easy_parse(date_string)
    • 'tomorrow', 'today' and 'yesterday' returns as you imagined
    • other string will be passed to original Date.parse
    • if invalid string is given, returns Date.today
  • Date#wday_position
    • returns position of wday in current month
    • e.g : 23, Jan 2016 is 4th Saturday of this month
[1] pry(main)> Date.today
=> #<Date: 2016-01-23 ((2457411j,0s,0n),+0s,2299161j)>
[2] pry(main)> Date.today.wday
=> 6
[3] pry(main)> Date.today.wday_position
=> 4
  • Date#wday_name(lang = :ja)
    • returns name of wday in specified language
  • Date#month_name(lang = :ja)
    • returns name of month in specified language
[1] pry(main)> Date.today
=> #<Date: 2016-01-26 ((2457414j,0s,0n),+0s,2299161j)>
[2] pry(main)> Date.today.wday_name
=> "火"
[3] pry(main)> Date.today.month_name
=> "睦月"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kwappa/date_misc.

License

The gem is available as open source under the terms of the MIT License.