Jack-Qin-King opened a new issue, #18015:
URL: https://github.com/apache/dolphinscheduler/issues/18015

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   Regarding the system parameter $[yyyyMMdd+N], when the system timezone is 
set to US West (America/Los_Angeles), there is a Daylight Saving Time (DST) 
transition issue where a day only has 23 hours.
   
   <!-- Failed to upload "image.png" -->
   
   In the code, day-based addition and subtraction is implemented using 
minutes, specifically through the calcMinutes method. The code hardcodes the 
calculation as 60*24*(%s). However, for the US West (Los Angeles) timezone, 
Daylight Saving Time (DST) transitions occur, causing the second Sunday of 
March to jump from 01:59:59 to 03:00:00—effectively losing one hour and making 
that day only 23 hours long. As a result, $[yyyyMMdd-1] subtracts one extra 
hour, leading to a two-day offset issue.
   
   
代码里针对天的加减是按照分钟去实现的,具体方法为calcMinutes,代码里硬编码为60*24*(%s),对于美西洛杉矶时区存在冬夏转换导致三月的第二个星期日
 01:59:59 会调到03:00:00 因此少了一个小时 只有23小时问题,因此$[yyyyMMdd-1] 会被多减一个小时导致少俩天问题
   
   
   here is my Test Case
   `// 启动前设置时区
           TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
           // 方法1: 使用 java.time 包 (推荐,Java 8+)
           ZonedDateTime laDateTime = ZonedDateTime.of(
                   2026, 3, 9,                    // 年, 月, 日
                   0, 10, 0,                      // 时, 分, 秒
                   0,                             // 纳秒
                   ZoneId.of("America/Los_Angeles")  // 洛杉矶时区
           );
   
           // 转换为 Date 对象
           Date date = Date.from(laDateTime.toInstant());
           
//System.out.println(TimePlaceholderUtils.getPlaceHolderTime("$[week_last_day(yyyy-MM-dd,0)
 - 1]", date));
           
System.out.println(TimePlaceholderUtils.getPlaceHolderTime("yyyy-MM-dd-1", 
date));
           
System.out.println(TimePlaceholderUtils.getPlaceHolderTime("yyyy-MM-dd", 
date));`
   
   <!-- Failed to upload "image.png" -->
   
   ### What you expected to happen
   
   fix the bug ,期望 $[yyyyMMdd-1] 只会少一天
   
   ### How to reproduce
   
   `  TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
           // 方法1: 使用 java.time 包 (推荐,Java 8+)
           ZonedDateTime laDateTime = ZonedDateTime.of(
                   2026, 3, 9,                    // 年, 月, 日
                   0, 10, 0,                      // 时, 分, 秒
                   0,                             // 纳秒
                   ZoneId.of("America/Los_Angeles")  // 洛杉矶时区
           );
   
           // 转换为 Date 对象
           Date date = Date.from(laDateTime.toInstant());
           
//System.out.println(TimePlaceholderUtils.getPlaceHolderTime("$[week_last_day(yyyy-MM-dd,0)
 - 1]", date));
           
System.out.println(TimePlaceholderUtils.getPlaceHolderTime("yyyy-MM-dd-1", 
date));
           
System.out.println(TimePlaceholderUtils.getPlaceHolderTime("yyyy-MM-dd", 
date));`
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   dev
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to