garydgregory commented on code in PR #1801:
URL: https://github.com/apache/commons-lang/pull/1801#discussion_r4272305301
##########
src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java:
##########
@@ -337,6 +342,46 @@ void testAddDays() throws Exception {
assertNullPointerException(() -> DateUtils.addDays(null, 0));
}
+ @DefaultTimeZone("Europe/Brussels")
+ @Test
+ void testAddDaysDaylightSavingTime() {
+ final TimeZone brusselsTz = TimeZones.getTimeZone("Europe/Brussels");
+
+ // 2012-03-25 00:00:00 CET: Brussels spring DST transition (23-hour
day)
+ final Calendar calSpring = Calendar.getInstance(brusselsTz);
+ calSpring.clear();
+ calSpring.set(2012, Calendar.MARCH, 25, 0, 0, 0);
+ final Date inputSpring = calSpring.getTime();
+
+ // In Europe/Brussels: calendar day advances to 2012-03-26 00:00:00
CEST (23 hours elapsed)
+ final Date outputSpring = DateUtils.addDays(inputSpring, 1);
+ assertEquals(23 * 3600 * 1000L, outputSpring.getTime() -
inputSpring.getTime());
Review Comment:
@Alwaysgaurav1 Please implement this suggestion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]