@@ -32,8 +32,23 @@ def test_date_strptime_with_commercial_week_date
32
32
end
33
33
34
34
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
35
40
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
36
48
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 )
37
52
end
38
53
39
54
def test_date_strptime_with_iso_8601_week_date
0 commit comments