Sha256: 64faef5789269f1914e60254cdef32bf2d2a146c32d2fa190e2d8587ab1b107a

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

# TimeCalculations

Extra methods for Date, Time, and DateTime.

## Installation

Add this line to your application's Gemfile:

    gem 'time_calculations'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install time_calculations

## Usage

    Time.parse('2002-02-02 02:02:02').beginning_of_hour   == Time.parse('2002-02-02 02:00:00')
    Time.parse('2002-02-02 02:02:02').beginning_of_minute == Time.parse('2002-02-02 02:02:00')

    Time.parse('2002-02-02 02:02:02').round_up(:year)   == Time.parse('2003-01-01 00:00:00')
    Time.parse('2002-01-01 00:00:00').round_up(:year)   == Time.parse('2002-01-01 00:00:00')
    Time.parse('2002-02-02 02:02:02').round_up(:month)  == Time.parse('2002-03-01 00:00:00')
    Time.parse('2002-02-01 00:00:00').round_up(:month)  == Time.parse('2002-02-01 00:00:00')
    Time.parse('2002-02-02 02:02:02').round_up(:day)    == Time.parse('2002-02-03 00:00:00')
    Time.parse('2002-02-02 00:00:00').round_up(:day)    == Time.parse('2002-02-02 00:00:00')
    Time.parse('2002-02-02 02:02:02').round_up(:hour)   == Time.parse('2002-02-02 03:00:00')
    Time.parse('2002-02-02 02:00:00').round_up(:hour)   == Time.parse('2002-02-02 02:00:00')
    Time.parse('2002-02-02 02:02:02').round_up(:minute) == Time.parse('2002-02-02 02:03:00')
    Time.parse('2002-02-02 02:02:00').round_up(:minute) == Time.parse('2002-02-02 02:02:00')

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
time_calculations-0.0.3 README.md
time_calculations-0.0.2 README.md
time_calculations-0.0.1 README.md