Skip to content

Commit 6dfacf5

Browse files
make sure i understand
1 parent 92654d1 commit 6dfacf5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/date_strptime_scenarios.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,23 @@ def test_date_strptime_with_commercial_week_date
3232
end
3333

3434
def test_date_strptime_with_commercial_week_date_and_day_of_week_from_sunday
35+
#2/27/1984 is a monday. wed the 29th is the last day of march.
36+
37+
#1984-09 is 9th commercial week of 1984 starting on monday 2/27
38+
#specifying day of week = 0 with non-commercial day of week means
39+
#we jump to sunday, so 6 days after monday 2/27 which is 3/4
3540
assert_equal Date.strptime('1984-09-0', '%G-%V-%w'), Date.new(1984, 3, 04)
41+
assert_equal Date.strptime('1984-09-1', '%G-%V-%w'), Date.new(1984, 2, 27)
42+
assert_equal Date.strptime('1984-09-2', '%G-%V-%w'), Date.new(1984, 2, 28)
43+
assert_equal Date.strptime('1984-09-3', '%G-%V-%w'), Date.new(1984, 2, 29)
44+
assert_equal Date.strptime('1984-09-6', '%G-%V-%w'), Date.new(1984, 3, 03)
45+
46+
#1984-09 is 9th commercial week of 1984 starting on a monday
47+
#specifying day of week = 1 with commercial day of week means stay at the 27th
3648
assert_equal Date.strptime('1984-09-1', '%G-%V-%u'), Date.new(1984, 2, 27)
49+
assert_equal Date.strptime('1984-09-2', '%G-%V-%u'), Date.new(1984, 2, 28)
50+
assert_equal Date.strptime('1984-09-3', '%G-%V-%u'), Date.new(1984, 2, 29)
51+
assert_equal Date.strptime('1984-09-7', '%G-%V-%u'), Date.new(1984, 3, 04)
3752
end
3853

3954
def test_date_strptime_with_iso_8601_week_date

0 commit comments

Comments
 (0)