GithubHelp home page GithubHelp logo

date_misc's Introduction

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.

date_misc's People

Contributors

kwappa avatar

Watchers

 avatar James Cloos avatar  avatar

date_misc's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.