diff --git a/ical/timezone.py b/ical/timezone.py index 2b76e74..b453da3 100644 --- a/ical/timezone.py +++ b/ical/timezone.py @@ -30,7 +30,6 @@ from .parsing.property import ParsedProperty from .types import Recur, Uri, UtcOffset from .tzif import timezoneinfo, tz_rule -from .util import dtstamp_factory __all__ = [ "Timezone", @@ -135,11 +134,6 @@ class Timezone(ComponentModel): sub-component. """ - dtstamp: Union[datetime.datetime, datetime.date] = Field( - default_factory=lambda: dtstamp_factory() - ) - """Last revision date.""" - tz_id: str = Field(alias="tzid") """An identifier for this Timezone, unique within a calendar.""" diff --git a/tests/__snapshots__/test_calendar_stream.ambr b/tests/__snapshots__/test_calendar_stream.ambr index 60121c8..23107a8 100644 --- a/tests/__snapshots__/test_calendar_stream.ambr +++ b/tests/__snapshots__/test_calendar_stream.ambr @@ -100,7 +100,6 @@ }), }), ]), - 'dtstamp': '2023-03-13T01:12:29', 'standard': list([ dict({ 'dtstart': '2010-11-07T02:00:00', @@ -1027,7 +1026,6 @@ }), }), ]), - 'dtstamp': '2022-08-11T06:12:12', 'last_modified': '2005-08-09T05:00:00+00:00', 'standard': list([ dict({ @@ -1278,7 +1276,6 @@ SEQUENCE:0 END:VEVENT BEGIN:VTIMEZONE - DTSTAMP:20230313T011229 TZID:America/Example BEGIN:STANDARD DTSTART:20101107T020000 @@ -1788,7 +1785,6 @@ PRODID:-//ABC Corporation//NONSGML My Product//EN VERSION:2.0 BEGIN:VTIMEZONE - DTSTAMP:20220811T061212 TZID:America/New_York LAST-MODIFIED:20050809T050000Z BEGIN:STANDARD diff --git a/tests/test_timezone.py b/tests/test_timezone.py index 8041d1b..387929b 100644 --- a/tests/test_timezone.py +++ b/tests/test_timezone.py @@ -94,7 +94,6 @@ def test_from_tzif_timezoneinfo_with_dst( PRODID:-//example//1.2.3 VERSION:2.0 BEGIN:VTIMEZONE - DTSTAMP:20220822T123000 TZID:America/New_York BEGIN:STANDARD DTSTART:20101107T020000 @@ -156,7 +155,6 @@ def test_from_tzif_timezoneinfo_fixed_offset( PRODID:-//example//1.2.3 VERSION:2.0 BEGIN:VTIMEZONE - DTSTAMP:20220822T123000 TZID:Asia/Tokyo BEGIN:STANDARD DTSTART:20100101T000000 @@ -175,3 +173,44 @@ def test_invalid_tzif_key() -> None: with pytest.raises(TimezoneInfoError, match=r"Unable to find timezone"): Timezone.from_tzif("invalid") + + + +@freeze_time("2022-08-22 12:30:00") +def test_clear_old_dtstamp( + mock_prodid: Generator[None, None, None] +) -> None: + """Verify a timezone created from a tzif timezone info with a fixed offset""" + + stream = IcsCalendarStream.from_ics(inspect.cleandoc(""" + BEGIN:VCALENDAR + PRODID:-//example//1.2.3 + VERSION:2.0 + BEGIN:VTIMEZONE + DTSTAMP:20220822T123000 + TZID:Asia/Tokyo + BEGIN:STANDARD + DTSTART:20100101T000000 + TZOFFSETTO:0900 + TZOFFSETFROM:0900 + TZNAME:JST + END:STANDARD + END:VTIMEZONE + END:VCALENDAR + """)) + # DTSTAMP is omitted from the output + assert stream.ics() == inspect.cleandoc(""" + BEGIN:VCALENDAR + PRODID:-//example//1.2.3 + VERSION:2.0 + BEGIN:VTIMEZONE + TZID:Asia/Tokyo + BEGIN:STANDARD + DTSTART:20100101T000000 + TZOFFSETTO:0900 + TZOFFSETFROM:0900 + TZNAME:JST + END:STANDARD + END:VTIMEZONE + END:VCALENDAR + """) diff --git a/tests/testdata/datetime_vtimezone.ics b/tests/testdata/datetime_vtimezone.ics index 77f6ea9..ef84afc 100644 --- a/tests/testdata/datetime_vtimezone.ics +++ b/tests/testdata/datetime_vtimezone.ics @@ -11,7 +11,6 @@ CREATED:20230313T011226 SEQUENCE:0 END:VEVENT BEGIN:VTIMEZONE -DTSTAMP:20230313T011229 TZID:America/Example BEGIN:STANDARD DTSTART:20101107T020000 @@ -28,4 +27,4 @@ RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3 TZNAME:PDT END:DAYLIGHT END:VTIMEZONE -END:VCALENDAR \ No newline at end of file +END:VCALENDAR diff --git a/tests/testdata/timezone_ny.ics b/tests/testdata/timezone_ny.ics index 2b421f2..e689f25 100644 --- a/tests/testdata/timezone_ny.ics +++ b/tests/testdata/timezone_ny.ics @@ -2,7 +2,6 @@ BEGIN:VCALENDAR PRODID:-//ABC Corporation//NONSGML My Product//EN VERSION:2.0 BEGIN:VTIMEZONE -DTSTAMP:20220811T061212 TZID:America/New_York LAST-MODIFIED:20050809T050000Z BEGIN:DAYLIGHT @@ -55,4 +54,4 @@ TZOFFSETTO:-0500 TZNAME:EST END:STANDARD END:VTIMEZONE -END:VCALENDAR \ No newline at end of file +END:VCALENDAR