@@ -81,9 +81,8 @@ def test_from_format_with_invalid_padded_day():
8181 ("12/02/1999" , "DD/MM/YYYY" , "1999-02-12T00:00:00+00:00" , None ),
8282 ("12_02_1999" , "DD_MM_YYYY" , "1999-02-12T00:00:00+00:00" , None ),
8383 ("12:02:1999" , "DD:MM:YYYY" , "1999-02-12T00:00:00+00:00" , None ),
84- ("2-2-99" , "D-M-YY" , "2099-02-02T00:00:00+00:00" , None ),
85- ("2-2-99" , "D-M-YY" , "1999-02-02T00:00:00+00:00" , "1990-01-01" ),
86- ("99" , "YY" , "2099-01-01T00:00:00+00:00" , None ),
84+ ("2-2-99" , "D-M-YY" , "1999-02-02T00:00:00+00:00" , None ),
85+ ("99" , "YY" , "1999-01-01T00:00:00+00:00" , None ),
8786 ("300-1999" , "DDD-YYYY" , "1999-10-27T00:00:00+00:00" , None ),
8887 ("12-02-1999 2:45:10" , "DD-MM-YYYY h:m:s" , "1999-02-12T02:45:10+00:00" , None ),
8988 ("12-02-1999 12:45:10" , "DD-MM-YYYY h:m:s" , "1999-02-12T12:45:10+00:00" , None ),
@@ -198,3 +197,25 @@ def test_strptime():
198197 assert_datetime (d , 1975 , 5 , 21 , 22 , 32 , 11 )
199198 assert isinstance (d , pendulum .DateTime )
200199 assert d .timezone_name == "UTC"
200+
201+
202+ def test_from_format_2_digit_year ():
203+ """
204+ Complies with open group spec for 2 digit years
205+ https://pubs.opengroup.org/onlinepubs/9699919799/
206+
207+ "If century is not specified, then values in the range [69,99] shall
208+ refer to years 1969 to 1999 inclusive, and values in the
209+ range [00,68] shall refer to years 2000 to 2068 inclusive."
210+ """
211+ d = pendulum .from_format ("00" , "YY" )
212+ assert d .year == 2000
213+
214+ d = pendulum .from_format ("68" , "YY" )
215+ assert d .year == 2068
216+
217+ d = pendulum .from_format ("69" , "YY" )
218+ assert d .year == 1969
219+
220+ d = pendulum .from_format ("99" , "YY" )
221+ assert d .year == 1999
0 commit comments