Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this patch
Currently, the user may specify, e.g.
Then it would correctly convert all timestamps to
'America/Sao_Paulo'
. However, it would also be displayed in the formgrader when the user sets the assignment's due date:When the user sends this form, the timezone string is concatenated to the time and passed to
utils.parse_utc
, which cannot handle this string format.After this patch
This patch converts
NbGraderAPI.timezone
to a format readable byparse_utc
before displaying it to the user in the formgrader. This way the user does not need to change the default value presented in the Timezone field: it will just use the configured timezone out-of-the-box.Note
The
dateutil.tz.gettz
function does not support reading a timezone in the numeric format (e.g.-0300
orUTC-3
), therefore it is not possible to use the numeric format to configureNbGraderAPI.timezone
.In other words, this patch is the only way to get the timezones working correctly in the Web UI. It also takes into account that the timezone offset might change during the course due to daylight savings.