Skip to content
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

Enable Scheduling - Add TZ to page StartDate and EndDate #3919

Merged
merged 1 commit into from
Jul 18, 2020

Conversation

daguiler
Copy link
Contributor

Fixes #3918

Summary

This is both a back-end issue and a front-end issue.

Initially, when start/end datetime is null, and the user picks a datetime in the date picker, the front-end sends the datetimes correctly as UTC, and the back-end API saves the datetimes correctly in the database as UTC.

Later, during browser refresh, the GetPageDetails API is called, which fails to specify the DateTimeKind as UTC when filling the DTO from the database, and therefore the datetimes are serialized back as local datetimes, which produces the offset in the front-end.

At this point, if the user changes the datetime back to the original value, this time the date picker returns a String instead of a javascript Date object, and the TZ info is lost there, and the API then receives a local datetime. This sort of fixes the problem thereafter, but out of pure luck I would say.

This pull request basically adds the lost TZ both in the back-end (by specifying the DateTimeKind) and the front-end (using Date objects with the view model instead of strings).

@@ -118,7 +118,10 @@ const PageService = function () {
const toFrontEndPage = function (pageResult) {
return {
...pageResult.page,
schedulingEnabled: pageResult.page.startDate || pageResult.page.endDate,
schedulingEnabled: pageResult.page.startDate !== null || pageResult.page.endDate !== null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was not strictly necessary, but React was complaining that schedulingEnabled was being assigned a string instead of a boolean value.

@mitchelsellers mitchelsellers merged commit 3e9d129 into dnnsoftware:develop Jul 18, 2020
@daguiler daguiler deleted the bugfix/DNN-33895 branch July 18, 2020 04:09
@LeoZandvliet LeoZandvliet mentioned this pull request Sep 8, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Page schedule Start and End dates change after saving
3 participants