https://github.com/readysteady/quarter
Ruby gem for working with standard calendar quarters
https://github.com/readysteady/quarter
date-time quarter ruby
Last synced: 2 months ago
JSON representation
Ruby gem for working with standard calendar quarters
- Host: GitHub
- URL: https://github.com/readysteady/quarter
- Owner: readysteady
- License: other
- Created: 2020-04-27T10:30:49.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-02T11:25:46.000Z (5 months ago)
- Last Synced: 2025-03-04T17:04:15.379Z (3 months ago)
- Topics: date-time, quarter, ruby
- Language: Ruby
- Homepage: https://rubygems.org/gems/quarter
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# quarter

Ruby gem for working with standard calendar quarters.
## Install
Using Bundler:
$ bundle add quarter
Using RubyGems:
$ gem install quarter
## Usage
```ruby
require 'quarter'date = Date.today
quarter = Quarter(date)
p quarter.start_date
p quarter.include?(date)
p quarter.next
p quarter.name
p quarter.to_s
p quarter.iso8601
```### Quarter::Methods
Include the `Quarter::Methods` module for methods which can be used to get the quarter for a given year in a manner that resembles written english. For example:
include Quarter::Methods
q1 = Q1 2020
### Quarter::Constants
Include the `Quarter::Constants` module for constants which can be used to get the quarter for a given year in a manner that resembles written english. For example:
include Quarter::Constants
q1 = Q1/2020
q2 = 2020-Q2
### YAML integration
Require `quarter/yaml` for YAML integration which supports dumping and loading quarter objects to and from YAML as scalar values. For example:
require 'quarter/yaml'
puts YAML.dump([Quarter.now])