Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22526 Allow GMT-23:59 time zone #2646

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -4581,7 +4581,7 @@ public int getMinimalDaysInFirstWeek()
{ 0, 0, 59, 59 }, // MINUTE
{ 0, 0, 59, 59 }, // SECOND
{ 0, 0, 999, 999 }, // MILLISECOND
{-16*ONE_HOUR, -16*ONE_HOUR, 12*ONE_HOUR, 30*ONE_HOUR }, // ZONE_OFFSET
{-24*ONE_HOUR, -16*ONE_HOUR, 12*ONE_HOUR, 30*ONE_HOUR }, // ZONE_OFFSET
{ 0, 0, 2*ONE_HOUR, 2*ONE_HOUR }, // DST_OFFSET
{/* */}, // YEAR_WOY
{ 1, 1, 7, 7 }, // DOW_LOCAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2419,6 +2419,13 @@ public void TestGetIanaID() {
}
}
}
@Test
public void TestGMTMinus24ICU22526() {
TimeZone tz = TimeZone.getTimeZone("GMT-23:59");
GregorianCalendar gc = new GregorianCalendar(tz);
gc.setTimeInMillis(123456789);
gc.get(GregorianCalendar.MONTH);
}
}

//eof