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

* fix: update date using utc timezone instead of local

* fix: lint error
This commit is contained in:
Kristin Aoki
2024-05-24 13:07:10 -04:00
committed by GitHub
parent 732b7ed86c
commit 435af2c36f

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;