timecop 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timecop/time_extensions.rb +15 -8
- data/lib/timecop/time_stack_item.rb +1 -1
- data/lib/timecop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad1963ee820d4d3519b4e078879aaa3914b2e9802460480fd9ca3c4a239677e4
|
4
|
+
data.tar.gz: 49a827fc02c8580d33d6861f51974dd046996e7281442c33f89c527d4d4c5af0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18895efbc69f3768fcf68fa372759e727c30869e5ff1a77c8b7a2901e4a89dd49fe61df38c0a5c57dd9604250e0c49733c990c32757ac9a374a56fb3962d441
|
7
|
+
data.tar.gz: 6938b5dfc45c545d8c0e83b757f1b99d9b69b2cfe23d5e1d0f9b4fc4ff56282af201a982bcf52084f05b0de88ea36256ecbe54e2988fc944693940f5179dcb97
|
@@ -58,14 +58,21 @@ class Date #:nodoc:
|
|
58
58
|
Date.new(year, mon, d[:mday], start)
|
59
59
|
elsif d[:yday]
|
60
60
|
Date.new(year, 1, 1, start).next_day(d[:yday] - 1)
|
61
|
-
elsif d[:cwyear] || d[:cweek] || d[:wnum1] || d[:wday] || d[:cwday]
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
elsif d[:cwyear] || d[:cweek] || d[:wnum0] || d[:wnum1] || d[:wday] || d[:cwday]
|
62
|
+
week = d[:cweek] || d[:wnum1] || d[:wnum0] || now.strftime('%W').to_i
|
63
|
+
if d[:wnum0] #Week of year where week starts on sunday
|
64
|
+
if d[:cwday] #monday based day of week
|
65
|
+
Date.strptime_without_mock_date("#{year} #{week} #{d[:cwday]}", '%Y %U %u', start)
|
66
|
+
else
|
67
|
+
Date.strptime_without_mock_date("#{year} #{week} #{d[:wday] || 0}", '%Y %U %w', start)
|
68
|
+
end
|
69
|
+
else #Week of year where week starts on monday
|
70
|
+
if d[:wday] #sunday based day of week
|
71
|
+
Date.strptime_without_mock_date("#{year} #{week} #{d[:wday]}", '%Y %W %w', start)
|
72
|
+
else
|
73
|
+
Date.strptime_without_mock_date("#{year} #{week} #{d[:cwday] || 1}", '%Y %W %u', start)
|
74
|
+
end
|
75
|
+
end
|
69
76
|
elsif d[:seconds]
|
70
77
|
Time.at(d[:seconds]).to_date
|
71
78
|
else
|
data/lib/timecop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timecop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Jeffery
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-08-
|
12
|
+
date: 2023-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem providing "time travel" and "time freezing" capabilities, making
|
15
15
|
it dead simple to test time-dependent code. It provides a unified method to mock
|