fat_core 4.8.0 → 4.8.1

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: bd64293fd2c62f0fc9e089c000b8853e71500fcd14cc3899b45402aa33d237d4
4
- data.tar.gz: fa7909a5eeab9e94a54c389e60257b64a626fc9d572029709509dd044ef2a410
3
+ metadata.gz: c1ee6aa869e6ebae3f5bc14e8be07629a0fa26f0b077975bbddd920c94c5df9b
4
+ data.tar.gz: e2d4197028b13d4bfb29365b2fe5bca3f568678bd7fdc391616ea30432d34617
5
5
  SHA512:
6
- metadata.gz: 43a94a1cdfa9595041ec2076981bca528d4da3824baf8a459fef8c41d44c88441003acfc8b804cb52f1b3fb6dcf7e7d9aa03b2f430b8db72af7d029fdbafa558
7
- data.tar.gz: d8c430838d4b4cb1610b9a1f7ab7cf679df6e828043b452751c0cf5bee58afab5752f5dd9184c4f04397e7e4335953414d6a7025be16ac7e3e10583992f1d3ca
6
+ metadata.gz: 74418e533e0d3f826866b6d1cf4e7614ea4897475f7254f9388c689f663928e484b4dd2109b541cb87775b5d43bb5d74e37c1a9a865f816d7ee36bec00beba46
7
+ data.tar.gz: 1ac7754b460710b1f0f346f75285cc63c7739f32d46e4533a451a90757d2ca111c110869260073b5104a9e0c53f06b02f9de9ce8b2cf09515892c3fa7d24273b
@@ -497,12 +497,16 @@ module FatCore
497
497
  # :category: Relative ::Dates
498
498
 
499
499
  # Return the date that is the last day of the commercial biweek in which
500
- # self falls. A biweek is a period of two commercial weeks starting with an
501
- # odd-numbered week and with each week starting in Monday and ending on
500
+ # self falls. A biweek is a period of two commercial weeks starting with
501
+ # an odd-numbered week and with each week starting in Monday and ending on
502
502
  # Sunday. So this will always return a Sunday in an even-numbered week.
503
- # @return [::Date]
503
+ # In the last week of the year (if it is not part of next year's first
504
+ # week) the end of the biweek will not extend beyond self's week, so that
505
+ # week 1 of the following year will start a new biweek. @return [::Date]
504
506
  def end_of_biweek
505
- if cweek.odd?
507
+ if cweek >= 52 && end_of_week(:monday).year > year
508
+ end_of_week(:monday)
509
+ elsif cweek.odd?
506
510
  (self + 1.week).end_of_week(:monday)
507
511
  else
508
512
  end_of_week(:monday)
@@ -1,7 +1,7 @@
1
1
  module FatCore
2
2
  MAJOR = 4
3
3
  MINOR = 8
4
- PATCH = 0
4
+ PATCH = 1
5
5
 
6
6
  # FatCore version number
7
7
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
@@ -577,6 +577,10 @@ describe Date do
577
577
  .to eq Date.parse('2013-11-17')
578
578
  expect(Date.parse('2013-03-11')).to be_beginning_of_biweek
579
579
  expect(Date.parse('2013-03-24')).to be_end_of_biweek
580
+ expect(Date.parse('2013-12-30').end_of_biweek)
581
+ .to eq Date.parse('2014-01-12')
582
+ expect(Date.parse('2009-12-30').end_of_biweek)
583
+ .to eq Date.parse('2010-01-03')
580
584
  end
581
585
 
582
586
  it 'should know about weeks' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.0
4
+ version: 4.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty