business 1.16.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91709bfa6facf01e0f781f91f9c4d0dcedc433cf3c19a98550d669430c218ecb
4
- data.tar.gz: 78d64d7010cc393a242e833b92678aacccdff65be62d5dceeb8ead4445d3870f
3
+ metadata.gz: 31ba206f257f17ef5bdfa3c60e9e81f2e5e2e71436a701513643f90e783d844d
4
+ data.tar.gz: bda97edfe037b2f509b4d037d46a39b89c5ed96130872c6e090da461c6783418
5
5
  SHA512:
6
- metadata.gz: 51f8b6c1d7b1ab4148c2364ff795eed77bbc9d758319e56aab823ac28eb8b215fc418291aeb6f2fd9ff1b0150e0f2e86c743f5dfeb1ccd87ca62f9bdcb990e9a
7
- data.tar.gz: 26ff497bc7fcc87b5cea3dcaeebb7b2568d2072390b73eabcc802fb3f1c299bd2ebb01f2a16c21482d3a852340c6dda16b5c63c854c9ae38167f943c5b8b547f
6
+ metadata.gz: 07576b028c3b7c31fd5be9fc1c1588b31b76b629d6381c73566a828db6add04ee47f7f24091274ef55c0441666551922a35b97ccbb112224fe85d3bf24865dd0
7
+ data.tar.gz: 81aae610dd327487aa95b11b04b12d5d909f3296c36a2d49ff9147dc1a2276b4e024fffe2fe5cb8fa072a60b2a667d7b5f0cf207e919e2bc796d6693d01a731a
@@ -0,0 +1,34 @@
1
+ version: 2.1
2
+
3
+ jobs:
4
+ test:
5
+ docker:
6
+ - image: circleci/ruby:<< parameters.ruby-version >>
7
+ parameters:
8
+ ruby-version:
9
+ type: string
10
+ steps:
11
+ - checkout
12
+ - restore_cache:
13
+ keys:
14
+ - bundle-v1-<< parameters.ruby-version >>-{{ checksum "business.gemspec" }}
15
+ - bundle-v1-<< parameters.ruby-version >>-
16
+ - run:
17
+ name: Install dependencies
18
+ command: bundle install --clean --no-cache --path vendor/bundle --jobs=4 --retry=3
19
+ - save_cache:
20
+ key: bundle-v1-<< parameters.ruby-version >>-{{ checksum "business.gemspec" }}
21
+ paths:
22
+ - vendor/bundle
23
+ - run:
24
+ name: Run tests
25
+ command: bundle exec rspec
26
+
27
+ workflows:
28
+ default:
29
+ jobs:
30
+ - test:
31
+ name: Ruby << matrix.ruby-version >>
32
+ matrix:
33
+ parameters:
34
+ ruby-version: ["2.4.9", "2.5.8", "2.6.6", "2.7.1"]
@@ -1,3 +1,31 @@
1
+ ## 2.0.0 - May 4, 2020
2
+
3
+ 🚨 **BREAKING CHANGES** 🚨
4
+
5
+ For more on the breaking changes that have been introduced in v2.0.0 please [see the readme](README.md#v200-breaking-changes).
6
+
7
+ - Remove bundled calendars see [this pr](https://github.com/gocardless/business/pull/54) for more context. If you need to use any of the previously bundled calendars, [see here](https://github.com/gocardless/business/tree/b12c186ca6fd4ffdac85175742ff7e4d0a705ef4/lib/business/data)
8
+ - `Business::Calendar.load_paths=` is now required
9
+
10
+ ## 1.18.0 - April 30, 2020
11
+
12
+ ### Note we have dropped support for Ruby < 2.4.x
13
+
14
+ - Correct Danish public holidays
15
+
16
+ ## 1.17.1 - November 19, 2019
17
+
18
+ - Change May Bank Holiday 2020 for UK (Bacs) - this was moved to the 8th.
19
+ - Add 2020 holidays for PAD.
20
+
21
+ ## 1.17.0 - October 30, 2019
22
+
23
+ - Add holiday calendar for France (Target(SEPA) + French bank holidays)
24
+
25
+ ## 1.16.1 - September 2, 2019
26
+
27
+ - Fix holiday calendar for ACH U.S.
28
+
1
29
  ## 1.16.0 - January 17, 2019
2
30
 
3
31
  - Add holiday calendar for ACH U.S.
data/README.md CHANGED
@@ -1,84 +1,139 @@
1
1
  # Business
2
2
 
3
3
  [![Gem version](https://badge.fury.io/rb/business.svg)](http://badge.fury.io/rb/business)
4
- [![Build status](https://travis-ci.org/gocardless/business.svg?branch=master)](https://travis-ci.org/gocardless/business)
4
+ [![CircleCI](https://circleci.com/gh/gocardless/business.svg?style=svg)](https://circleci.com/gh/gocardless/business)
5
5
 
6
6
  Date calculations based on business calendars.
7
7
 
8
- ## Documentation
8
+ - [v2.0.0 breaking changes](#v200-breaking-changes)
9
+ - [Getting Started](#getting-started)
10
+ - [Creating a calendar](#creating-a-calendar)
11
+ - [Using a calendar file](#use-a-calendar-file)
12
+ - [Checking for business days](#checking-for-business-days)
13
+ - [Business day arithmetic](#business-day-arithmetic)
14
+ - [But other libraries already do this](#but-other-libraries-already-do-this)
15
+ - [License & Contributing](#license--contributing)
9
16
 
10
- To get business, simply:
17
+ ## v2.0.0 breaking changes
18
+
19
+ We have removed the bundled calendars as of version 2.0.0, if you need the calendars that were included:
20
+
21
+ - Download the calendars you wish to use from [v1.18.0](https://github.com/gocardless/business/tree/b12c186ca6fd4ffdac85175742ff7e4d0a705ef4/lib/business/data)
22
+ - Place them in a suitable directory in your project, typically `lib/calendars`
23
+ - Add this directory path to your instance of `Business::Calendar` using the `load_paths` method.dd the directory to where you placed the yml files before you load the calendar
24
+
25
+ ```ruby
26
+ Business::Calendar.load_paths("lib/calendars") # your_project/lib/calendars/ contains bacs.yml
27
+ Business::Calendar.load("bacs")
28
+ ```
29
+
30
+ If you wish to stay on the last version that contained bundled calendars, pin `business` to `v1.18.0`
31
+
32
+ ```ruby
33
+ # Gemfile
34
+ gem "business", "v1.18.0"
35
+ ```
36
+
37
+ ## Getting started
38
+
39
+ To install business, simply:
11
40
 
12
41
  ```bash
13
- $ gem install business
42
+ gem install business
43
+ ```
44
+
45
+ If you are using a Gemfile:
46
+
47
+ ```ruby
48
+ gem "business", "~> 2.0"
14
49
  ```
15
50
 
16
- ### Getting started
51
+ ### Creating a calendar
17
52
 
18
- Get started with business by creating an instance of the calendar class,
19
- passing in a hash that specifies with days of the week are considered working
20
- days, and which days are holidays.
53
+ Get started with business by creating an instance of the calendar class, that accepts a hash that specifies which days of the week are considered working days, which days are holidays and which are extra working dates.
21
54
 
22
55
  ```ruby
23
56
  calendar = Business::Calendar.new(
24
57
  working_days: %w( mon tue wed thu fri ),
25
58
  holidays: ["01/01/2014", "03/01/2014"] # array items are either parseable date strings, or real Date objects
59
+ extra_working_dates: [nil], # Makes the calendar to consider a weekend day as a working day.
26
60
  )
27
61
  ```
28
62
 
29
- `extra_working_dates` key makes the calendar to consider a weekend day as a working day.
63
+ ### Use a calendar file
30
64
 
31
- A few calendar configs are bundled with the gem (see [lib/business/data]((lib/business/data)) for
32
- details). Load them by calling the `load` class method on `Calendar`. The
33
- `load_cached` variant of this method caches the calendars by name after loading
34
- them, to avoid reading and parsing the config file multiple times.
65
+ Defining a calendar as a Ruby object may not be convenient, so we provide a way of defining these calendars as YAML. Below we will walk through the necessary [steps](#example-calendar) to build your first calendar. All keys are optional and will default to the following:
35
66
 
36
- ```ruby
37
- calendar = Business::Calendar.load("weekdays")
38
- calendar = Business::Calendar.load_cached("weekdays")
39
- ```
67
+ Note: Elements of `holidays` and `extra_working_dates` may be either strings that `Date.parse()` [can understand](https://ruby-doc.org/stdlib-2.7.1/libdoc/date/rdoc/Date.html#method-c-parse), or `YYYY-MM-DD` (which is considered as a Date by Ruby YAML itself)[https://github.com/ruby/psych/blob/6ec6e475e8afcf7868b0407fc08014aed886ecf1/lib/psych/scalar_scanner.rb#L60].
40
68
 
41
- If `working_days` is missing, then common default is used (mon-fri).
42
- If `holidays` is missing, "no holidays" assumed.
43
- If `extra_working_dates` is missing, then no changes in `working_days` will happen.
69
+ #### YAML file Structure
70
+
71
+ ```yml
72
+ working_days: # Optional, default [Monday-Friday]
73
+ -
74
+ holidays: # Optional, default: [] ie: "no holidays" assumed
75
+ -
76
+ extra_working_dates: # Optional, default: [], ie: no changes in `working_days` will happen
77
+ -
78
+ ```
44
79
 
45
- Elements of `holidays` and `extra_working_dates` may be
46
- eiter strings that `Date.parse()` can understand,
47
- or YYYY-MM-DD (which is considered as a Date by Ruby YAML itself).
80
+ #### Example calendar
48
81
 
49
82
  ```yaml
83
+ # lib/calendars/my_calendar.yml
84
+ working_days:
85
+ - Monday
86
+ - Wednesday
87
+ - Friday
50
88
  holidays:
51
- - 2017-01-08 # Same as January 8th, 2017
89
+ - 1st April 2020
90
+ - 2021-04-01
91
+ extra_working_dates:
92
+ - 9th March 2020 # A Saturday
52
93
  ```
53
94
 
54
- ### Checking for business days
95
+ Ensure the calendar file is saved to a directory that will hold all your calendars, typically `lib/calendars`, then add this directory to your instance of `Business::Calendar` using the `load_paths` method before you call your calendar.
55
96
 
56
- To check whether a given date is a business day (falls on one of the specified
57
- working days or working dates, and is not a holiday), use the `business_day?`
58
- method on `Calendar`.
97
+ `load_paths` also accepts an array of plain Ruby hashes with the format:
59
98
 
60
99
  ```ruby
61
- calendar.business_day?(Date.parse("Monday, 9 June 2014"))
62
- # => true
63
- calendar.business_day?(Date.parse("Sunday, 8 June 2014"))
64
- # => false
100
+ { "calendar_name" => { "working_days" => [] }
65
101
  ```
66
102
 
67
- ### Custom calendars
103
+ #### Example loading both a path and ruby hashes
104
+
105
+ ```ruby
106
+ Business::Calendar.load_paths = [
107
+ "lib/calendars",
108
+ { "foo_calendar" => { "working_days" => ["monday"] } },
109
+ { "bar_calendar" => { "working_days" => ["sunday"] } },
110
+ ]
111
+ ```
68
112
 
69
- To use a calendar you've written yourself, you need to add the directory it's
70
- stored in as an additional calendar load path:
113
+ Now you can load the calendar by calling the `Business::Calendar.load(calendar_name)`. In order to avoid parsing the calendar file multiple times, there is a `Business::Calendar.load_cached(calendar_name)` method that caches the calendars by name after loading them.
71
114
 
72
115
  ```ruby
73
- Business::Calendar.additional_load_paths = ['path/to/your/calendar/directory']
116
+ calendar = Business::Calendar.load("my_calendar") # lib/calendars/my_calendar.yml
117
+ calendar = Business::Calendar.load("foo_calendar")
118
+ # or
119
+ calendar = Business::Calendar.load_cached("my_calendar")
120
+ calendar = Business::Calendar.load_cached("foo_calendar")
74
121
  ```
75
122
 
76
- You can then load the calendar as normal.
123
+ ## Checking for business days
77
124
 
78
- ### Business day arithmetic
125
+ To check whether a given date is a business day (falls on one of the specified working days or working dates, and is not a holiday), use the `business_day?` method on `Business::Calendar`.
79
126
 
80
- The `add_business_days` and `subtract_business_days` are used to perform
81
- business day arithmetic on dates.
127
+ ```ruby
128
+ calendar.business_day?(Date.parse("Monday, 9 June 2014"))
129
+ # => true
130
+ calendar.business_day?(Date.parse("Sunday, 8 June 2014"))
131
+ # => false
132
+ ```
133
+
134
+ ## Business day arithmetic
135
+
136
+ The `add_business_days` and `subtract_business_days` are used to perform business day arithmetic on dates.
82
137
 
83
138
  ```ruby
84
139
  date = Date.parse("Thursday, 12 June 2014")
@@ -88,10 +143,7 @@ calendar.subtract_business_days(date, 4).strftime("%A, %d %B %Y")
88
143
  # => "Friday, 06 June 2014"
89
144
  ```
90
145
 
91
- The `roll_forward` and `roll_backward` methods snap a date to a nearby business
92
- day. If provided with a business day, they will return that date. Otherwise,
93
- they will advance (forward for `roll_forward` and backward for `roll_backward`)
94
- until a business day is found.
146
+ The `roll_forward` and `roll_backward` methods snap a date to a nearby business day. If provided with a business day, they will return that date. Otherwise, they will advance (forward for `roll_forward` and backward for `roll_backward`) until a business day is found.
95
147
 
96
148
  ```ruby
97
149
  date = Date.parse("Saturday, 14 June 2014")
@@ -101,10 +153,7 @@ calendar.roll_backward(date).strftime("%A, %d %B %Y")
101
153
  # => "Friday, 13 June 2014"
102
154
  ```
103
155
 
104
- To count the number of business days between two dates, pass the dates to
105
- `business_days_between`. This method counts from start of the first date to
106
- start of the second date. So, assuming no holidays, there would be two business
107
- days between a Monday and a Wednesday.
156
+ To count the number of business days between two dates, pass the dates to `business_days_between`. This method counts from start of the first date to start of the second date. So, assuming no holidays, there would be two business days between a Monday and a Wednesday.
108
157
 
109
158
  ```ruby
110
159
  date = Date.parse("Saturday, 14 June 2014")
@@ -112,38 +161,19 @@ calendar.business_days_between(date, date + 7)
112
161
  # => 5
113
162
  ```
114
163
 
115
- ### Included Calendars
116
-
117
- We include some calendar data with this Gem but give no guarantees of its
118
- accuracy.
119
- The calendars that we include are:
120
-
121
- * Bacs
122
- * Bankgirot
123
- * BECS (Australia)
124
- * BECSNZ (New Zealand)
125
- * PAD (Canada)
126
- * Betalingsservice
127
- * Target (SEPA)
128
-
129
164
  ## But other libraries already do this
130
165
 
131
- Another gem, [business_time](https://github.com/bokmann/business_time), also
132
- exists for this purpose. We previously used business_time, but encountered
133
- several issues that prompted us to start business.
166
+ Another gem, [business_time](https://github.com/bokmann/business_time), also exists for this purpose. We previously used business_time, but encountered several issues that prompted us to start business.
167
+
168
+ Firstly, business_time works by monkey-patching `Date`, `Time`, and `FixNum`. While this enables syntax like `Time.now + 1.business_day`, it means that all configuration has to be global. GoCardless handles payments across several geographies, so being able to work with multiple working-day calendars is
169
+ essential for us. Business provides a simple `Calendar` class, that is initialized with a configuration that specifies which days of the week are considered to be working days, and which dates are holidays.
134
170
 
135
- Firstly, business_time works by monkey-patching `Date`, `Time`, and `FixNum`.
136
- While this enables syntax like `Time.now + 1.business_day`, it means that all
137
- configuration has to be global. GoCardless handles payments across several
138
- geographies, so being able to work with multiple working-day calendars is
139
- essential for us. Business provides a simple `Calendar` class, that is
140
- initialized with a configuration that specifies which days of the week are
141
- considered to be working days, and which dates are holidays.
171
+ Secondly, business_time supports calculations on times as well as dates. For our purposes, date-based calculations are sufficient. Supporting time-based calculations as well makes the code significantly more complex. We chose to avoid this extra complexity by sticking solely to date-based mathematics.
142
172
 
143
- Secondly, business_time supports calculations on times as well as dates. For
144
- our purposes, date-based calculations are sufficient. Supporting time-based
145
- calculations as well makes the code significantly more complex. We chose to
146
- avoid this extra complexity by sticking solely to date-based mathematics.
173
+ <p align="center"><img src="http://3.bp.blogspot.com/-aq4iOz2OZzs/Ty8xaQwMhtI/AAAAAAAABrM/-vn4tcRA9-4/s1600/daily-morning-awesomeness-243.jpeg" alt="I'm late for business" width="250"/></p>
147
174
 
175
+ ## License & Contributing
176
+ - business is available as open source under the terms of the [MIT License](LICENSE).
177
+ - Bug reports and pull requests are welcome on GitHub at https://github.com/gocardless/business.
148
178
 
149
- ![I'm late for business](http://3.bp.blogspot.com/-aq4iOz2OZzs/Ty8xaQwMhtI/AAAAAAAABrM/-vn4tcRA9-4/s1600/daily-morning-awesomeness-243.jpeg)
179
+ GoCardless open source. If you do too, come [join us](https://gocardless.com/about/jobs).
@@ -19,4 +19,5 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "rspec", "~> 3.1"
22
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
22
23
  end
@@ -1,32 +1,41 @@
1
1
  require 'yaml'
2
+ require 'date'
2
3
 
3
4
  module Business
4
5
  class Calendar
5
6
  class << self
6
- attr_accessor :additional_load_paths
7
+ attr_accessor :load_paths
7
8
  end
8
9
 
9
10
  def self.calendar_directories
10
- directories = @additional_load_paths || []
11
- directories + [File.join(File.dirname(__FILE__), 'data')]
11
+ @load_paths
12
12
  end
13
13
  private_class_method :calendar_directories
14
14
 
15
- def self.load(calendar)
16
- directory = calendar_directories.find do |dir|
17
- File.exists?(File.join(dir, "#{calendar}.yml"))
15
+ def self.load(calendar_name)
16
+ data = calendar_directories.detect do |path|
17
+ if path.is_a?(Hash)
18
+ break path[calendar_name] if path[calendar_name]
19
+ else
20
+ next unless File.exists?(File.join(path, "#{calendar_name}.yml"))
21
+
22
+ break YAML.load_file(File.join(path, "#{calendar_name}.yml"))
23
+ end
18
24
  end
19
- raise "No such calendar '#{calendar}'" unless directory
20
25
 
21
- yaml = YAML.load_file(File.join(directory, "#{calendar}.yml"))
26
+ raise "No such calendar '#{calendar_name}'" unless data
27
+
22
28
  valid_keys = %w(holidays working_days extra_working_dates)
23
29
 
24
- unless (yaml.keys - valid_keys).empty?
30
+ unless (data.keys - valid_keys).empty?
25
31
  raise "Only valid keys are: #{valid_keys.join(', ')}"
26
32
  end
27
33
 
28
- self.new(holidays: yaml['holidays'], working_days: yaml['working_days'],
29
- extra_working_dates: yaml['extra_working_dates'])
34
+ self.new(
35
+ holidays: data['holidays'],
36
+ working_days: data['working_days'],
37
+ extra_working_dates: data['extra_working_dates'],
38
+ )
30
39
  end
31
40
 
32
41
  @lock = Mutex.new
@@ -1,3 +1,3 @@
1
1
  module Business
2
- VERSION = "1.16.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -8,27 +8,17 @@ end
8
8
 
9
9
  describe Business::Calendar do
10
10
  describe ".load" do
11
+ let(:dummy_calendar) { { "working_days" => ["monday"] } }
12
+
11
13
  before do
12
14
  fixture_path = File.join(File.dirname(__FILE__), 'fixtures', 'calendars')
13
- Business::Calendar.additional_load_paths = [fixture_path]
14
- end
15
-
16
- context "when given a valid calendar" do
17
- subject { Business::Calendar.load("weekdays") }
18
-
19
- it "loads the yaml file" do
20
- expect(YAML).to receive(:load_file) { |path|
21
- expect(path).to match(/weekdays\.yml$/)
22
- }.and_return({})
23
- subject
24
- end
25
-
26
- it { is_expected.to be_a Business::Calendar }
15
+ described_class.load_paths = [fixture_path, { "foobar" => dummy_calendar }]
27
16
  end
28
17
 
29
18
  context "when given a calendar from a custom directory" do
30
- after { Business::Calendar.additional_load_paths = nil }
31
- subject { Business::Calendar.load("ecb") }
19
+ subject { described_class.load("ecb") }
20
+
21
+ after { described_class.load_paths = nil }
32
22
 
33
23
  it "loads the yaml file" do
34
24
  expect(YAML).to receive(:load_file) { |path|
@@ -49,6 +39,12 @@ describe Business::Calendar do
49
39
  end
50
40
  end
51
41
 
42
+ context "when loading a calendar as a hash" do
43
+ subject { described_class.load("foobar") }
44
+
45
+ it { is_expected.to be_a Business::Calendar }
46
+ end
47
+
52
48
  context "when given a calendar that does not exist" do
53
49
  subject { Business::Calendar.load("invalid-calendar") }
54
50
  specify { expect { subject }.to raise_error(/No such calendar/) }
@@ -72,19 +68,6 @@ describe Business::Calendar do
72
68
  end
73
69
  end
74
70
 
75
- describe "bundled calendars" do
76
- calendars = Dir.glob("../lib/business/data*.yml")
77
- .map { |f| File.basename(f, ".yml") }
78
-
79
- calendars.each do |calendar|
80
- describe calendar do
81
- it "should load without issues" do
82
- expect { Business::Calendar.load(calendar) }.not_to raise_error
83
- end
84
- end
85
- end
86
- end
87
-
88
71
  describe "#set_working_days" do
89
72
  let(:calendar) { Business::Calendar.new({}) }
90
73
  let(:working_days) { [] }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: business
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Marr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-28 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec_junit_formatter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.4.1
27
41
  description: Date calculations based on business calendars
28
42
  email:
29
43
  - developers@gocardless.com
@@ -31,9 +45,9 @@ executables: []
31
45
  extensions: []
32
46
  extra_rdoc_files: []
33
47
  files:
48
+ - ".circleci/config.yml"
34
49
  - ".gitignore"
35
50
  - ".ruby-version"
36
- - ".travis.yml"
37
51
  - CHANGELOG.md
38
52
  - Gemfile
39
53
  - LICENSE
@@ -41,15 +55,6 @@ files:
41
55
  - business.gemspec
42
56
  - lib/business.rb
43
57
  - lib/business/calendar.rb
44
- - lib/business/data/achus.yml
45
- - lib/business/data/bacs.yml
46
- - lib/business/data/bankgirot.yml
47
- - lib/business/data/becs.yml
48
- - lib/business/data/becsnz.yml
49
- - lib/business/data/betalingsservice.yml
50
- - lib/business/data/padca.yml
51
- - lib/business/data/target.yml
52
- - lib/business/data/weekdays.yml
53
58
  - lib/business/version.rb
54
59
  - spec/calendar_spec.rb
55
60
  - spec/fixtures/calendars/bacs.yml
@@ -74,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
79
  - !ruby/object:Gem::Version
75
80
  version: '0'
76
81
  requirements: []
77
- rubyforge_project:
78
- rubygems_version: 2.7.6
82
+ rubygems_version: 3.1.2
79
83
  signing_key:
80
84
  specification_version: 4
81
85
  summary: Date calculations based on business calendars
@@ -1,17 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.5.1
5
- - 2.4.3
6
- - 2.3.7
7
- - 2.2.10
8
- - 2.1.10
9
-
10
- sudo: false
11
-
12
- before_install:
13
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
14
- - gem install bundler -v '< 2'
15
-
16
- script:
17
- - bundle exec rspec spec
@@ -1,57 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 1st, 2019
10
- - January 21st, 2019
11
- - February 18th, 2019
12
- - May 27th, 2019
13
- - July 4th, 2019
14
- - October 14th, 2019
15
- - November 11th, 2019
16
- - November 28th, 2019
17
- - December 25th, 2019
18
- - January 1st, 2020
19
- - January 20th, 2020
20
- - February 17th, 2020
21
- - May 25th, 2020
22
- - July 4th, 2020
23
- - September 7th, 2020
24
- - October 12th, 2020
25
- - November 11th, 2020
26
- - November 26th, 2020
27
- - December 25th, 2020
28
- - January 1st, 2021
29
- - January 18th, 2021
30
- - February 15th, 2021
31
- - May 31st, 2021
32
- - July 5th, 2021
33
- - September 6th, 2021
34
- - October 11th, 2021
35
- - November 11th, 2021
36
- - November 25th, 2021
37
- - December 25th, 2021
38
- - January 1st, 2022
39
- - January 17th, 2022
40
- - February 21st, 2022
41
- - May 30th, 2022
42
- - July 4th, 2022
43
- - September 5th, 2022
44
- - October 10th, 2022
45
- - November 11th, 2022
46
- - November 24th, 2022
47
- - December 26th, 2022
48
- - January 2nd, 2023
49
- - January 16th, 2023
50
- - February 20th, 2023
51
- - May 29th, 2023
52
- - July 4th, 2023
53
- - September 4th, 2023
54
- - October 9th, 2023
55
- - November 11th, 2023
56
- - November 23rd, 2023
57
- - December 25th, 2023
@@ -1,129 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 1st, 2013
10
- - March 29th, 2013
11
- - April 1st, 2013
12
- - May 6th, 2013
13
- - May 27th, 2013
14
- - August 26th, 2013
15
- - December 25th, 2013
16
- - December 26th, 2013
17
- - January 1st, 2014
18
- - April 18th, 2014
19
- - April 21st, 2014
20
- - May 5th, 2014
21
- - May 26th, 2014
22
- - August 25th, 2014
23
- - December 25th, 2014
24
- - December 26th, 2014
25
- - January 1st, 2015
26
- - April 3rd, 2015
27
- - April 6th, 2015
28
- - May 4th, 2015
29
- - May 25th, 2015
30
- - August 31st, 2015
31
- - December 25th, 2015
32
- - December 28th, 2015
33
- - January 1st, 2016
34
- - March 25th, 2016
35
- - March 28th, 2016
36
- - May 2nd, 2016
37
- - May 30th, 2016
38
- - August 29th, 2016
39
- - December 26th, 2016
40
- - December 27th, 2016
41
- - January 2nd, 2017
42
- - April 14th, 2017
43
- - April 17th, 2017
44
- - May 1st, 2017
45
- - May 29th, 2017
46
- - August 28th, 2017
47
- - December 25th, 2017
48
- - December 26th, 2017
49
- - January 1st, 2018
50
- - March 30th, 2018
51
- - April 2nd, 2018
52
- - May 7th, 2018
53
- - May 28th, 2018
54
- - August 27th, 2018
55
- - December 25th, 2018
56
- - December 26th, 2018
57
- - January 1st, 2019
58
- - April 19th, 2019
59
- - April 22nd, 2019
60
- - May 6th, 2019
61
- - May 27th, 2019
62
- - August 26th, 2019
63
- - December 25th, 2019
64
- - December 26th, 2019
65
- - January 1st, 2020
66
- - April 10th, 2020
67
- - April 13th, 2020
68
- - May 4th, 2020
69
- - May 25th, 2020
70
- - August 31st, 2020
71
- - December 25th, 2020
72
- - December 26th, 2020
73
- - December 28th, 2020
74
- - January 1st, 2021
75
- - April 2nd, 2021
76
- - April 5th, 2021
77
- - May 3rd, 2021
78
- - May 31st, 2021
79
- - August 30th, 2021
80
- - December 27th, 2021
81
- - December 28th, 2021
82
- - January 3rd, 2022
83
- - April 15th, 2022
84
- - April 18th, 2022
85
- - May 2nd, 2022
86
- - May 30th, 2022
87
- - August 29th, 2022
88
- - December 26th, 2022
89
- - December 27th, 2022
90
- - January 2nd, 2023
91
- - April 7th, 2023
92
- - April 10th, 2023
93
- - May 1st, 2023
94
- - May 29th, 2023
95
- - August 28th, 2023
96
- - December 25th, 2023
97
- - December 26th, 2023
98
- - January 1st, 2024
99
- - March 29th, 2024
100
- - April 1st, 2024
101
- - May 6th, 2024
102
- - May 27th, 2024
103
- - August 26th, 2024
104
- - December 25th, 2024
105
- - December 26th, 2024
106
- - January 1st, 2025
107
- - April 18th, 2025
108
- - April 21st, 2025
109
- - May 5th, 2025
110
- - May 26th, 2025
111
- - August 25th, 2025
112
- - December 25th, 2025
113
- - December 26th, 2025
114
- - January 1st, 2026
115
- - April 3rd, 2026
116
- - April 6th, 2026
117
- - May 4th, 2026
118
- - May 25th, 2026
119
- - August 31st, 2026
120
- - December 25th, 2026
121
- - December 28th, 2026
122
- - January 1st, 2027
123
- - March 26th, 2027
124
- - March 29th, 2027
125
- - May 3rd, 2027
126
- - May 31st, 2027
127
- - August 30th, 2027
128
- - December 27th, 2027
129
- - December 28th, 2027
@@ -1,208 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 1st, 2015
10
- - January 6th, 2015
11
- - April 3rd, 2015
12
- - April 6th, 2015
13
- - May 1st, 2015
14
- - May 14th, 2015
15
- - June 6th, 2015
16
- - June 19th, 2015
17
- - December 24th, 2015
18
- - December 25th, 2015
19
- - December 26th, 2015
20
- - December 31st, 2015
21
- - January 1st, 2016
22
- - January 6th, 2016
23
- - March 25th, 2016
24
- - March 28th, 2016
25
- - May 1st, 2016
26
- - May 5th, 2016
27
- - June 6th, 2016
28
- - June 24th, 2016
29
- - December 24th, 2016
30
- - December 25th, 2016
31
- - December 26th, 2016
32
- - December 31st, 2016
33
- - January 1st, 2017
34
- - January 6th, 2017
35
- - April 14th, 2017
36
- - April 16th, 2017
37
- - April 17th, 2017
38
- - May 1st, 2017
39
- - May 25th, 2017
40
- - June 4th, 2017
41
- - June 6th, 2017
42
- - June 23rd, 2017
43
- - June 24th, 2017
44
- - November 4th, 2017
45
- - December 24th, 2017
46
- - December 25th, 2017
47
- - December 26th, 2017
48
- - December 31st, 2017
49
- - January 1st, 2018
50
- - January 6th, 2018
51
- - March 30th, 2018
52
- - April 1st, 2018
53
- - April 2nd, 2018
54
- - May 1st, 2018
55
- - May 10th, 2018
56
- - May 20th, 2018
57
- - June 6th, 2018
58
- - June 22rd, 2018
59
- - June 23rd, 2018
60
- - November 3rd, 2018
61
- - December 24th, 2018
62
- - December 25th, 2018
63
- - December 26th, 2018
64
- - December 31st, 2018
65
- - January 1st, 2019
66
- - January 6th, 2019
67
- - April 19th, 2019
68
- - April 21st, 2019
69
- - April 22nd, 2019
70
- - May 1st, 2019
71
- - May 30th, 2019
72
- - June 6th, 2019
73
- - June 9th, 2019
74
- - June 21st, 2019
75
- - June 22nd, 2019
76
- - November 2nd, 2019
77
- - December 24th, 2019
78
- - December 25th, 2019
79
- - December 26th, 2019
80
- - December 31st, 2019
81
- - January 1st, 2020
82
- - January 6th, 2020
83
- - April 10th, 2020
84
- - April 12th, 2020
85
- - April 13th, 2020
86
- - May 1st, 2020
87
- - May 21st, 2020
88
- - May 31st, 2020
89
- - June 6th, 2020
90
- - June 19th, 2020
91
- - June 20th, 2020
92
- - October 31st, 2020
93
- - December 24th, 2020
94
- - December 25th, 2020
95
- - December 26th, 2020
96
- - December 31st, 2020
97
- - January 1st, 2021
98
- - January 6th, 2021
99
- - April 2nd, 2021
100
- - April 4th, 2021
101
- - April 5th, 2021
102
- - May 1st, 2021
103
- - May 13th, 2021
104
- - May 23rd, 2021
105
- - June 6th, 2021
106
- - June 25th, 2021
107
- - June 26th, 2021
108
- - November 6th, 2021
109
- - December 24th, 2021
110
- - December 25th, 2021
111
- - December 26th, 2021
112
- - December 31st, 2021
113
- - January 1st, 2022
114
- - January 6th, 2022
115
- - April 15th, 2022
116
- - April 17th, 2022
117
- - April 18th, 2022
118
- - May 1st, 2022
119
- - May 26th, 2022
120
- - June 5th, 2022
121
- - June 6th, 2022
122
- - June 24th, 2022
123
- - June 25th, 2022
124
- - November 5th, 2022
125
- - December 24th, 2022
126
- - December 25th, 2022
127
- - December 26th, 2022
128
- - December 31st, 2022
129
- - January 1st, 2023
130
- - January 6th, 2023
131
- - April 7th, 2023
132
- - April 9th, 2023
133
- - April 10th, 2023
134
- - May 1st, 2023
135
- - May 18th, 2023
136
- - May 28th, 2023
137
- - June 6th, 2023
138
- - June 23rd, 2023
139
- - June 24th, 2023
140
- - November 4th, 2023
141
- - December 24th, 2023
142
- - December 25th, 2023
143
- - December 26th, 2023
144
- - December 31st, 2023
145
- - January 1st, 2024
146
- - January 6th, 2024
147
- - March 29th, 2024
148
- - March 31st, 2024
149
- - April 1st, 2024
150
- - May 1st, 2024
151
- - May 9th, 2024
152
- - May 19th, 2024
153
- - June 6th, 2024
154
- - June 21st, 2023
155
- - June 22nd, 2023
156
- - November 2nd, 2024
157
- - December 24th, 2024
158
- - December 25th, 2024
159
- - December 26th, 2024
160
- - December 31st, 2024
161
- - January 1st, 2025
162
- - January 6th, 2025
163
- - April 18th, 2025
164
- - April 20th, 2025
165
- - April 21st, 2025
166
- - May 1st, 2025
167
- - May 29th, 2025
168
- - June 6th, 2025
169
- - June 8th, 2025
170
- - June 20th, 2025
171
- - June 21st, 2025
172
- - November 1st, 2025
173
- - December 24th, 2025
174
- - December 25th, 2025
175
- - December 26th, 2025
176
- - December 31st, 2025
177
- - January 1st, 2026
178
- - January 6th, 2026
179
- - April 3rd, 2026
180
- - April 5th, 2026
181
- - April 6th, 2026
182
- - May 1st, 2026
183
- - May 14th, 2026
184
- - May 24th, 2026
185
- - June 6th, 2026
186
- - June 19th, 2026
187
- - June 20th, 2026
188
- - October 31st, 2026
189
- - December 24th, 2026
190
- - December 25th, 2026
191
- - December 26th, 2026
192
- - December 31st, 2026
193
- - January 1st, 2027
194
- - January 6th, 2027
195
- - March 26th, 2027
196
- - March 28th, 2027
197
- - March 29th, 2027
198
- - May 1st, 2027
199
- - May 6th, 2027
200
- - May 16th, 2027
201
- - June 6th, 2027
202
- - June 25th, 2027
203
- - June 26th, 2027
204
- - November 6th, 2027
205
- - December 24th, 2027
206
- - December 25th, 2027
207
- - December 26th, 2027
208
- - December 31st, 2027
@@ -1,36 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 1st, 2017
10
- - January 26th, 2017
11
- - April 14th, 2017
12
- - April 17th, 2017
13
- - April 25th, 2017
14
- - December 25th, 2017
15
- - December 26th, 2017
16
- - January 1st, 2018
17
- - January 26th, 2018
18
- - March 30th, 2018
19
- - April 2nd, 2018
20
- - April 25th, 2018
21
- - December 25th, 2018
22
- - December 26th, 2018
23
- - January 1st, 2019
24
- - January 28th, 2019
25
- - April 19th, 2019
26
- - April 22nd, 2019
27
- - April 25th, 2019
28
- - December 25th, 2019
29
- - December 26th, 2019
30
- - January 1st, 2020
31
- - January 27th, 2020
32
- - April 10th, 2020
33
- - April 13nd, 2020
34
- - April 25th, 2020
35
- - December 25th, 2020
36
- - December 28th, 2020
@@ -1,50 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 2nd, 2017
10
- - January 3rd, 2017
11
- - February 6th, 2017
12
- - April 14th, 2017
13
- - April 17th, 2017
14
- - April 25th, 2017
15
- - June 5th, 2017
16
- - October 23rd, 2017
17
- - December 25th, 2017
18
- - December 26th, 2017
19
- - January 1st, 2018
20
- - January 2nd, 2018
21
- - February 6th, 2018
22
- - March 30th, 2018
23
- - April 2nd, 2018
24
- - April 25th, 2018
25
- - June 4th, 2018
26
- - October 22nd, 2018
27
- - December 25th, 2018
28
- - December 26th, 2018
29
- - January 1st, 2019
30
- - January 2nd, 2019
31
- - February 6th, 2019
32
- - April 19th, 2019
33
- - April 22nd, 2019
34
- - April 25th, 2019
35
- - June 3rd, 2019
36
- - October 28th, 2019
37
- - December 25th, 2019
38
- - December 26th, 2019
39
- - January 1st, 2020
40
- - January 2nd, 2020
41
- - February 6th, 2020
42
- - April 10th, 2020
43
- - April 13th, 2020
44
- - April 27th, 2020
45
- - June 1st, 2020
46
- - October 26th, 2020
47
- - December 25th, 2020
48
- - December 28th, 2020
49
-
50
-
@@ -1,54 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 1st, 2017
10
- - April 13th, 2017
11
- - April 14th, 2017
12
- - April 16th, 2017
13
- - April 17th, 2017
14
- - May 12th, 2017
15
- - May 25th, 2017
16
- - May 26th, 2017
17
- - June 5th, 2017
18
- - December 25th, 2017
19
- - December 26th, 2017
20
- - January 1st, 2018
21
- - March 29th, 2018
22
- - March 30th, 2018
23
- - April 2nd, 2018
24
- - April 27th, 2018
25
- - May 10th, 2018
26
- - May 11th, 2018
27
- - May 21st, 2018
28
- - June 5th, 2018
29
- - December 25th, 2018
30
- - December 26th, 2018
31
- - December 31st, 2018
32
- - January 1st, 2019
33
- - April 18th, 2019
34
- - April 19th, 2019
35
- - April 22nd, 2019
36
- - May 17th, 2019
37
- - May 30th, 2019
38
- - May 31st, 2019
39
- - June 5th, 2019
40
- - June 10th, 2019
41
- - December 25th, 2019
42
- - December 26th, 2019
43
- - December 31st, 2019
44
- - January 1st, 2020
45
- - April 9th, 2020
46
- - April 10th, 2020
47
- - April 12th, 2020
48
- - April 13th, 2020
49
- - May 8th, 2020
50
- - May 31st, 2020
51
- - June 1st, 2020
52
- - June 5th, 2020
53
- - December 25th, 2020
54
- - December 26th, 2020
@@ -1,27 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 1st, 2018
10
- - March 30th, 2018
11
- - May 21st, 2018
12
- - July 2nd, 2018
13
- - September 3rd, 2018
14
- - October 8th, 2018
15
- - November 12th, 2018
16
- - December 25th, 2018
17
- - December 26th, 2018
18
- - January 1st, 2019
19
- - April 19th, 2019
20
- - May 20th, 2019
21
- - July 1st, 2019
22
- - September 2nd, 2019
23
- - October 14th, 2019
24
- - November 11th, 2019
25
- - December 25th, 2019
26
- - December 26th, 2019
27
- - January 1st, 2020
@@ -1,98 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday
7
-
8
- holidays:
9
- - January 1st, 2013
10
- - March 29th, 2013
11
- - April 1st, 2013
12
- - May 1st, 2013
13
- - December 25th, 2013
14
- - December 26th, 2013
15
- - January 1st, 2014
16
- - April 18th, 2014
17
- - April 21st, 2014
18
- - May 1st, 2014
19
- - December 25th, 2014
20
- - December 26th, 2014
21
- - January 1st, 2015
22
- - April 3rd, 2015
23
- - April 6th, 2015
24
- - May 1st, 2015
25
- - December 25th, 2015
26
- - December 26th, 2015
27
- - January 1st, 2016
28
- - March 25th, 2016
29
- - March 28th, 2016
30
- - May 1st, 2016
31
- - December 25th, 2016
32
- - December 26th, 2016
33
- - January 1st, 2017
34
- - April 14th, 2017
35
- - April 17th, 2017
36
- - May 1st, 2017
37
- - December 25th, 2017
38
- - December 26th, 2017
39
- - January 1st, 2018
40
- - March 30th, 2018
41
- - April 2nd, 2018
42
- - May 1st, 2018
43
- - December 25th, 2018
44
- - December 26th, 2018
45
- - January 1st, 2019
46
- - April 19th, 2019
47
- - April 22nd, 2019
48
- - May 1st, 2019
49
- - December 25th, 2019
50
- - December 26th, 2019
51
- - January 1st, 2020
52
- - April 10th, 2020
53
- - April 13th, 2020
54
- - May 1st, 2020
55
- - December 25th, 2020
56
- - December 26th, 2020
57
- - January 1st, 2021
58
- - April 2nd, 2021
59
- - April 5th, 2021
60
- - May 1st, 2021
61
- - December 25th, 2021
62
- - December 26th, 2021
63
- - January 1st, 2022
64
- - April 15th, 2022
65
- - April 18th, 2022
66
- - May 1st, 2022
67
- - December 25th, 2022
68
- - December 26th, 2022
69
- - January 1st, 2023
70
- - April 7th, 2023
71
- - April 10th, 2023
72
- - May 1st, 2023
73
- - December 25th, 2023
74
- - December 26th, 2023
75
- - January 1st, 2024
76
- - March 29th, 2024
77
- - April 1st, 2024
78
- - May 1st, 2024
79
- - December 25th, 2024
80
- - December 26th, 2024
81
- - January 1st, 2025
82
- - April 18th, 2025
83
- - April 21st, 2025
84
- - May 1st, 2025
85
- - December 25th, 2025
86
- - December 26th, 2025
87
- - January 1st, 2026
88
- - April 3rd, 2026
89
- - April 6th, 2026
90
- - May 1st, 2026
91
- - December 25th, 2026
92
- - December 26th, 2026
93
- - January 1st, 2027
94
- - March 26th, 2027
95
- - March 29th, 2027
96
- - May 1st, 2027
97
- - December 25th, 2027
98
- - December 26th, 2027
@@ -1,6 +0,0 @@
1
- working_days:
2
- - monday
3
- - tuesday
4
- - wednesday
5
- - thursday
6
- - friday