ruanwenjun commented on code in PR #18726:
URL: 
https://github.com/apache/dolphinscheduler/pull/18726#discussion_r4355380548


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java:
##########
@@ -626,17 +666,33 @@ public static Map.Entry<Date, String> calcMonths(String 
expression, Date date) {
         if (params.length == 2) {
             String dateFormat = params[0];
             String monthExpr = params[1];
+            Map.Entry<Date, String> baseEntry = calcFormatOffset(dateFormat, 
date);
+            Date baseDate = baseEntry.getKey();
+            String cleanFormat = baseEntry.getValue();
+
             Integer addMonth = calculate(monthExpr);
-            Date targetDate = addMonths(date, addMonth);
+            Date targetDate = addMonths(baseDate, addMonth);
 
-            return new AbstractMap.SimpleImmutableEntry<>(targetDate, 
dateFormat);
+            return new AbstractMap.SimpleImmutableEntry<>(targetDate, 
cleanFormat);
         }
 
         throw new RuntimeException("expression not valid");
     }
 
+    /**
+     * Matches a timezone offset literal appended to the date format argument 
of a boundary function,
+     * such as 0800 in month_first_day(yyyy-MM-dd+0800) or 08:00 in 
month_first_day(yyyy-MM-dd+08:00).
+     * Timezone offsets range from UTC-12:00 to UTC+14:00, so only hours up to 
14 with minutes up to
+     * 59 are accepted. Standard placeholders are not affected by this 
pattern: their operands always
+     * keep the legacy numeric day-offset semantics.
+     */
+    private static final Pattern TIMEZONE_PATTERN =
+            
Pattern.compile("^((?:0\\d|1[0-4])[0-5]\\d|(?:0\\d|1[0-4]):[0-5]\\d)$");
+

Review Comment:
   LGTM, it's better to announce this at the md doc we support timezone at the 
parameter.



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