From 7c0ad9fa378bb72c59a63924ce3e0658e64b8659 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Tue, 13 Sep 2022 10:58:38 +0200 Subject: [PATCH] Set time in autotranslater's use of IntlCalendar to prevent issues with DST --- src/NodaTimeAutotranslater.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/NodaTimeAutotranslater.php b/src/NodaTimeAutotranslater.php index 78df7de..ed2cb0d 100644 --- a/src/NodaTimeAutotranslater.php +++ b/src/NodaTimeAutotranslater.php @@ -567,6 +567,10 @@ final class NodaTimeAutotranslater { $dateGeneral->set(IntlCalendar::FIELD_DAY_OF_MONTH, (int)$timeInfo['zeit_zaehlzeit_tag']); } + // Set time to noon, so that time zones or DST will not make a difference + $dateGeneral->set(IntlCalendar::FIELD_AM_PM, 0); // 0: AM, 1: PM + $dateGeneral->set(IntlCalendar::FIELD_HOUR, 11); + $format = match($usecase) { NodaTimeAutotranslaterUseCase::MONTH => $tLang->formatYearMonthForIntlDateFormatter(), default => $tLang->formatFullDateForIntlDateFormatter(),