You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/04/28 11:59:57 UTC

[GitHub] [dolphinscheduler] caishunfeng commented on a diff in pull request #9830: [Bug-9829][Api] Fix schedule timezone

caishunfeng commented on code in PR #9830:
URL: https://github.com/apache/dolphinscheduler/pull/9830#discussion_r860804467


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java:
##########
@@ -173,8 +174,12 @@ public Map<String, Object> insertSchedule(User loginUser,
             putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
             return result;
         }
-        scheduleObj.setStartTime(scheduleParam.getStartTime());
-        scheduleObj.setEndTime(scheduleParam.getEndTime());
+
+        // transform timezone from system default timezone to schedule timezone
+        Date startTime = DateUtils.transformTimezoneDate(scheduleParam.getStartTime(), scheduleParam.getTimezoneId());
+        Date endTime = DateUtils.transformTimezoneDate(scheduleParam.getEndTime(), scheduleParam.getTimezoneId());
+        scheduleObj.setStartTime(startTime);
+        scheduleObj.setEndTime(endTime);

Review Comment:
   @ruanwenjun Thanks for your good suggestion, I have recovered the `lazy-transform` logic, please review again.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org