Skip to content

Commit

Permalink
ICU-22526 Allow GMT-23:59 time zone
Browse files Browse the repository at this point in the history
ECMA402 now allow offset timezone from -23:59 to 23:59.
We need to lower the minimum ZONE_OFFSET value to -23:59
  • Loading branch information
FrankYFTang committed Oct 2, 2023
1 parent 3446660 commit ce43a69
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion icu4c/source/i18n/calendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ static const int32_t kCalendarLimits[UCAL_FIELD_COUNT][4] = {
{ 0, 0, 59, 59 }, // MINUTE
{ 0, 0, 59, 59 }, // SECOND
{ 0, 0, 999, 999 }, // MILLISECOND
{-16*kOneHour, -16*kOneHour, 12*kOneHour, 30*kOneHour }, // ZONE_OFFSET
{-24*kOneHour, -16*kOneHour, 12*kOneHour, 30*kOneHour }, // ZONE_OFFSET
{ -1*kOneHour, -1*kOneHour, 2*kOneHour, 2*kOneHour }, // DST_OFFSET
{/*N/A*/-1, /*N/A*/-1, /*N/A*/-1, /*N/A*/-1}, // YEAR_WOY
{ 1, 1, 7, 7 }, // DOW_LOCAL
Expand Down
10 changes: 10 additions & 0 deletions icu4c/source/test/intltest/tztest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ void TimeZoneTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
TESTCASE_AUTO(TestCasablancaNameAndOffset22041);
TESTCASE_AUTO(TestRawOffsetAndOffsetConsistency22041);
TESTCASE_AUTO(TestGetIanaID);
TESTCASE_AUTO(TestGMTMinus24ICU22526);
TESTCASE_AUTO_END;
}

Expand Down Expand Up @@ -2664,4 +2665,13 @@ void TimeZoneTest::TestGetIanaID() {
}
}
}

void TimeZoneTest::TestGMTMinus24ICU22526() {
UErrorCode status = U_ZERO_ERROR;
LocalPointer<TimeZone> tz(TimeZone::createTimeZone("GMT-23:59"), status);
U_ASSERT(U_SUCCESS(status));
GregorianCalendar gc(tz.orphan(), status);
gc.setTime(123456789, status);
gc.get(UCAL_MONTH, status);
}
#endif /* #if !UCONFIG_NO_FORMATTING */
1 change: 1 addition & 0 deletions icu4c/source/test/intltest/tztest.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class TimeZoneTest: public CalendarTimeZoneTest {
void TestGetIDForWindowsID();
void TestCasablancaNameAndOffset22041();
void TestRawOffsetAndOffsetConsistency22041();
void TestGMTMinus24ICU22526();

void TestGetIanaID();

Expand Down

0 comments on commit ce43a69

Please sign in to comment.