iampratap7997-dot commented on issue #18015: URL: https://github.com/apache/dolphinscheduler/issues/18015#issuecomment-4024973340
> i find other question use addDays also have problem,when schedul time is 2026-03-09 02:40:58 use addDay() will more 1 day become 2026-03-09 03:40:58 > > <img alt="Image" width="1203" height="628" src="https://private-user-images.githubusercontent.com/66464458/560211970-ea17b993-97c1-4bb7-a20d-cdaeacca791f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzMwNzMzMzEsIm5iZiI6MTc3MzA3MzAzMSwicGF0aCI6Ii82NjQ2NDQ1OC81NjAyMTE5NzAtZWExN2I5OTMtOTdjMS00YmI3LWEyMGQtY2RhZWFjY2E3OTFmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzA5VDE2MTcxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3NjBlMGU2NGQyMWFlMmMwYjc4MWU1NTZhY2NhYzU3YjQ0MzA2YmVkZGNhNGI4ZTgxZDAwYmRhNDg4ZjE1YmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.HDc7KPES5TgleH74xUYzWHBZqnuHvgItOS94sXinyPI"> here is my test case ` TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); // 方法1: 使用 java.time 包 (推荐,Java 8+) ZonedDateTime laDateTim e = ZonedDateTime.of( 2026, 3, 9, // 年, 月, 日 2, 40, 58, // 时, 分, 秒 0, // 纳秒 ZoneId.of("America/Los_Angeles") // 洛杉矶时区 ); > ``` > // 转换为 Date 对象 > Date businessDate = Date.from(laDateTime.toInstant()); > > businessDate = addDays(businessDate, -1);` > ``` Thanks for testing and pointing this out. You are right that `addDays()` can still be affected by DST bcz internally it also works with time, which may cause the hour to shift during DST transitions. Since the placeholders only require date-level calculation, I will update the implementation to use `LocalDate` based arithmetic instead of `Date` to avoid DST-related time shifts. I will push an updated fix shortly. -- 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]
