Skip to content

Commit

Permalink
fix: use same date format as server
Browse files Browse the repository at this point in the history
  • Loading branch information
superskip committed Sep 5, 2023
1 parent 6d89fd0 commit e3ad11d
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from '@dhis2/ui';
import i18n from '@dhis2/d2-i18n';
import { withStyles } from '@material-ui/core';
import { parseDate } from 'capture-core-utils/parsers';
import { convertValue as convertValueClientToView } from '../../../converters/clientToView';
import { dataElementTypes } from '../../../metaData';

Expand Down Expand Up @@ -87,9 +86,9 @@ const DateComponentPlain = ({
const saveHandler = () => {
// CalendarInput component only supports the YYYY-MM-DD format
if (selectedDate) {
const dateObject = parseDate(selectedDate, 'YYYY-MM-DD').momentDate;
if (dateObject && dateObject.toISOString() !== date) {
onSave(dateObject.toISOString(true));
const newDate = moment.utc(selectedDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss.SSS');
if (newDate !== date) {
onSave(newDate);
}
}
setEditMode(false);
Expand Down

0 comments on commit e3ad11d

Please sign in to comment.