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

fix publish schedule time picker #4355

Conversation

petrjasek
Copy link
Member

avoid time conversion from local time to utc when saving.

SDESK-7080

avoid time conversion from local time to utc when saving.

SDESK-7080
@petrjasek petrjasek requested a review from thecalcc November 1, 2023 16:24
@petrjasek petrjasek added this to the 2.7 milestone Nov 1, 2023
@@ -364,7 +365,14 @@ export function toQueryString(
* Output example: "1970-01-19T22:57:38"
*/
export function toServerDateFormat(date: Date): string {
return date.toJSON().slice(0, 19);
return moment(date).toISOString(true).slice(0, 19);
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need moment here? Could you implement the same thing without it? We're creating a black box here by using moment that supports a thousand features and it's not clear which will be invoked here. You could also use a function from date-fns - those are much more explicit.

Copy link
Member Author

Choose a reason for hiding this comment

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

I need something that won't change the time when converting it to ISO format, will check date-fns

Copy link
Member

Choose a reason for hiding this comment

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

Looks like formatISO from date-fns does the job. It'd be good to add a comment also that this is your intention so someone who looks at it in the future understands why aren't you using the built-in ".toISOString"

@petrjasek petrjasek merged commit a705b47 into superdesk:authoring-react-post-broadcasting Nov 8, 2023
3 checks passed
@petrjasek petrjasek deleted the fix-publish-schedule-date-time-picker branch November 8, 2023 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants