ruanwenjun commented on code in PR #9830:
URL: https://github.com/apache/dolphinscheduler/pull/9830#discussion_r860669600
##########
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:
I think there is no need to transform the data when insert into database.
And we also no need to transform the data when query from database and return
to front-end. Since we also insert the timezoneId into database.
e.g. If front-end give us a scheme time `2022-4-28 00:00:00`, timezone is
UTC, our server is at Shanghai. Then we can directly insert the origin data
into database, and return the `2022-4-28 00:00:00`, timezone `UTC` to
front-end, when do a query.
We only need to do the transform when we give the schedule time into quartz.
--
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]