New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-72653] fix timezone handling #301
Conversation
the implementation to prefill the scheduled time with the global value was not working properly, when the timezone of the controller was different from the timezone that was configured. The implementation used java.util.Date which has only limited capabilites to work with timeszones. This change replaces all date/time handling with new classes from the java.time packages. The timezone is no longer a free text field but a dropdown that gets filled with all available zone ids. The datetime field to schedule a build is no longer locale dependent but uses a fixed format based on 24h format (see [JENKINS-72645]). It is optional to enter seconds. The actual timezone that will be used is shown as field description. The time input on global config allows to specify am/pm but also 24h formats, seconds are optional.
src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java
Fixed
Show fixed
Hide fixed
src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java
Fixed
Show fixed
Hide fixed
src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java
Fixed
Show fixed
Hide fixed
src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java
Dismissed
Show dismissed
Hide dismissed
Thanks very much! This is a very nice improvement! @darinpope had wanted us to make this type of improvement since shortly after we adopted the plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much.
I noticed while doing data entry that the plugin previously accepted AM/PM suffix when entering a scheduled build time, but it no longer accepts the AM/PM suffix. Could you include support for the AM/PM suffix?
src/main/resources/org/jenkinsci/plugins/schedulebuild/ScheduleBuildAction/index.jelly
Outdated
Show resolved
Hide resolved
…plugin into JENKINS-72645
done previously it was possible to use |
This looks good in my testing. My American brain does not immediately recognize ISO-8601 format dates (dd-MM-yyyy), but that is the international standard and it is unambiguous. I'm more accustomed to dates that include the first three letters of the month as an English language string (like 08-Mar-2024) , but that is not part of the ISO-8601 standard and is specific to English. I'd like to do a little more testing before merging and releasing a new version. Thanks very much for the improvement! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Sorry for the delay with the merge and release.
I don't know if this is a me problem, but when scheduling a new job, the default date is tomorrow at 4am, which I'll assume is the value in GMT, even though the UI implies the timezone is America/Chicago. Shouldn't the default date/time (tonight at 10pm) be displayed correctly in the UI, even if it's stored in GMT? For reference, I'm in America/Chicago TZ, and attempting to schedule 'now' (951am on 4/8/2024) for 930pm tonight |
The value you enter will be applied to the mentioned timezone (America/Chicago). The timezone and the default start time in that timezone are configured in the system configuration. |
JENKINS-72653 - fix timezone handling
the implementation to prefill the scheduled time with the global value was not working properly, when the timezone of the controller was different from the timezone that was configured. The implementation used java.util.Date which has only limited capabilities to work with timeszones.
This change replaces all date/time handling with the new classes from the java.time packages.
The timezone is no longer a free text field but a dropdown that gets filled with all available zone ids.
The datetime field to schedule a build is no longer locale dependent but uses a fixed format based on 24h format (see [JENKINS-72645]). It is optional to enter seconds.
The actual timezone that will be used is shown as field description.
The time input on global config allows to specify am/pm but also 24h formats, seconds are optional.
The config format has changed, but the old format can still be read. Once installed and config is saved, rolling back to a previous version requires changes to the config.
Before:
the format hint is wrong with german locale, it is unclear which timezone is used.
The default config is for 10 PM with Sydney time zone , but gets calculated to some strange value. The controller runs in UTC timezone but the time shown is what will be the time in Sydney when it is 10PM UTC (Sydney is UTC + 11).
After:
full format hint, timezone is shown
Checklist
Types of changes
What types of changes does your code introduce?
Further comments
If this is a relatively large or complex change, start the discussion by explaining why you chose the solution you did and what alternatives you considered.