|
21 | 21 | import re
|
22 | 22 | from typing import List, Optional, TYPE_CHECKING, Tuple
|
23 | 23 |
|
24 |
| -from metomi.isodatetime.data import Calendar, CALENDAR, Duration |
| 24 | +from metomi.isodatetime.data import Calendar, CALENDAR |
25 | 25 | from metomi.isodatetime.dumpers import TimePointDumper
|
26 | 26 | from metomi.isodatetime.timezone import (
|
27 | 27 | get_local_time_zone, get_local_time_zone_format, TimeZoneFormatMode)
|
@@ -699,14 +699,6 @@ def ingest_time(value: str, now: Optional[str] = None) -> str:
|
699 | 699 | now = get_current_time_string()
|
700 | 700 | now_point = parser.parse(now)
|
701 | 701 |
|
702 |
| - # correct for year in 'now' if year is the only date unit specified - |
703 |
| - # https://github.com/cylc/cylc-flow/issues/4805#issuecomment-1103928604 |
704 |
| - if re.search(r"\(-\d{2}[);T]", value): |
705 |
| - now_point += Duration(years=1) |
706 |
| - # likewise correct for month if year and month are the only date units |
707 |
| - elif re.search(r"\(-\d{4}[);T]", value): |
708 |
| - now_point += Duration(months=1) |
709 |
| - |
710 | 702 | # perform whatever transformation is required
|
711 | 703 | offset = None
|
712 | 704 | if is_prev_next:
|
@@ -799,28 +791,6 @@ def prev_next(
|
799 | 791 |
|
800 | 792 | cycle_point = timepoints[my_diff.index(min(my_diff))]
|
801 | 793 |
|
802 |
| - # ensure truncated dates do not have time from 'now' included' - |
803 |
| - # https://github.com/metomi/isodatetime/issues/212 |
804 |
| - if 'T' not in value.split(')')[0]: |
805 |
| - # NOTE: Strictly speaking we shouldn't forcefully mutate TimePoints |
806 |
| - # in this way as they're meant to be immutable since |
807 |
| - # https://github.com/metomi/isodatetime/pull/165, however it |
808 |
| - # should be ok as long as the TimePoint is not used as a dict key and |
809 |
| - # we don't call any of the TimePoint's cached methods until after we've |
810 |
| - # finished mutating it. |
811 |
| - cycle_point._hour_of_day = 0 |
812 |
| - cycle_point._minute_of_hour = 0 |
813 |
| - cycle_point._second_of_minute = 0 |
814 |
| - # likewise ensure month and day from 'now' are not included |
815 |
| - # where they did not appear in the truncated datetime |
816 |
| - if re.search(r"\(-\d{2}[);T]", value): |
817 |
| - # case 1 - year only |
818 |
| - cycle_point._month_of_year = 1 |
819 |
| - cycle_point._day_of_month = 1 |
820 |
| - elif re.search(r"\(-(-\d{2}|\d{4})[;T)]", value): |
821 |
| - # case 2 - month only or year and month |
822 |
| - cycle_point._day_of_month = 1 |
823 |
| - |
824 | 794 | return cycle_point, offset
|
825 | 795 |
|
826 | 796 |
|
|
0 commit comments