preserve abbreviated month spellings

This commit is contained in:
kigland 2026-08-01 22:32:51 +08:00
parent f1cab7d9eb
commit dcd688ee8b
2 changed files with 5 additions and 0 deletions

View file

@ -46,7 +46,9 @@ _DURATION_UNIT_ALIASES: Final[dict[str, str]] = { # mutable-ok: constant lookup
"week": "w",
"weeks": "w",
"mo": "mo",
"mos": "mo",
"mon": "mo",
"mons": "mo",
"month": "mo",
"months": "mo",
}

View file

@ -421,6 +421,9 @@ class TestDurationInSeconds(unittest.TestCase):
with self.subTest(duration=duration):
self.assertEqual(duration_in_seconds(duration), expected)
self.assertEqual(duration_in_seconds("1mos"), duration_in_seconds("1mo"))
self.assertEqual(duration_in_seconds("2mons"), duration_in_seconds("2mo"))
def test_long_unit_spelling_sets_reset_interval(self):
now = datetime(2023, 5, 15, 15, 0, 0, tzinfo=timezone.utc)
self.assertEqual(