fix: update date using utc timezone instead of local (#1043) (#1055)

* fix: update date using utc timezone instead of local

* fix: lint error

Co-authored-by: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com>
This commit is contained in:
Glib Glugovskiy
2024-05-29 16:46:28 +03:00
committed by GitHub
parent a88066a2c5
commit 3c8e5b2501

View File

@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
import { useToggle } from '@openedx/paragon';
import { COMMA_SEPARATED_DATE_FORMAT } from '../constants';
import { convertToDateFromString } from '../utils';
import { getCourseHandouts, getCourseUpdates } from './data/selectors';
import { REQUEST_TYPES } from './constants';
import {
@@ -55,9 +56,10 @@ const useCourseUpdates = ({ courseId }) => {
};
const handleUpdatesSubmit = (data) => {
const dateWithoutTimezone = convertToDateFromString(data.date);
const dataToSend = {
...data,
date: moment(data.date).format(COMMA_SEPARATED_DATE_FORMAT),
date: moment(dateWithoutTimezone).format(COMMA_SEPARATED_DATE_FORMAT),
};
const { id, date, content } = dataToSend;