opening_hours_converter 1.7.3 → 1.7.4

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
  SHA1:
3
- metadata.gz: 2247a30906f6ff73bd768acc2470f298759acb30
4
- data.tar.gz: 9603a200c0c5ab697ed36f2895c8d4c660f24a3f
3
+ metadata.gz: d86fe1aa14a6ac56a0bdac562323672d2032b2fa
4
+ data.tar.gz: d70a925a60170967c50150c5e4ac7016f7b8f3ea
5
5
  SHA512:
6
- metadata.gz: 6ba007fcc7844a3870cd9b4a6a5ed4c59a677d9975e714e7e0133cb8a8a848d65fc79570bed8f9d290dc5ac82a4796463c0c1c7a7273c945de8b8801a97def17
7
- data.tar.gz: 3010c805469d1a8ca0f907e84f47e6925139cf030efa2dcacc74b976d68cc445f0dc5744238fcc95b9bee68be41320216181cee8575cbbfef38331d47d75c46d
6
+ metadata.gz: 7441d6f58bf6b85293e2e8ba9a1510089fcd1ab0f339ade09b291c3ab9a09245ddc5717f42cf0eaa6fb887404cfc1d0e01ad62fe93d7ebec69a617364b4feefe
7
+ data.tar.gz: f66495e7b07a9371fcc5cee21aeeff41dcf756e52b8ca974b5a815f2aa6de882e4de945df3044e9a6fd642329f4692a1534de4b3d90c2eec2e7a30306b838842
@@ -475,6 +475,7 @@ module OpeningHoursConverter
475
475
  end
476
476
 
477
477
  def width
478
+ return Float::INFINITY if @type == "always"
478
479
  in_day = to_day
479
480
  days_count = 0
480
481
  if in_day.end
@@ -505,12 +506,24 @@ module OpeningHoursConverter
505
506
  end
506
507
  else
507
508
  for month in in_day.start[:month]..in_day.end[:month]
508
- days_count += MONTH_END_DAY[month - 1]
509
+ if month == in_day.end[:month]
510
+ days_count += in_day.end[:day]
511
+ elsif month == in_day.start[:month]
512
+ days_count += MONTH_END_DAY[month - 1] - in_day.start[:day]
513
+ else
514
+ days_count += MONTH_END_DAY[month - 1]
515
+ end
509
516
  end
510
517
  end
511
518
  else
512
519
  for month in in_day.start[:month]..in_day.end[:month]
513
- days_count += MONTH_END_DAY[month - 1]
520
+ if month == in_day.end[:month]
521
+ days_count += in_day.end[:day]
522
+ elsif month == in_day.start[:month]
523
+ days_count += MONTH_END_DAY[month - 1] - in_day.start[:day]
524
+ else
525
+ days_count += MONTH_END_DAY[month - 1]
526
+ end
514
527
  end
515
528
  end
516
529
  return days_count
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opening_hours_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ziserman Martin