Skip to content

Commit

Permalink
fix: take into account that moment has configurable locale settings
Browse files Browse the repository at this point in the history
  • Loading branch information
superskip committed Apr 29, 2024
1 parent 7b5ff09 commit cfc05d3
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
import moment from 'moment';
import { ProgramStage } from '../../../../../metaData';
import { dataElementTypes, ProgramStage } from '../../../../../metaData';
import { convertClientToServer } from '../../../../../converters';
import { convertCategoryOptionsToServer } from '../../../../../converters/clientToServer';

const ignoreAutoGenerateIfApplicable = (stage, firstStageDuringRegistrationEvent) =>
Expand Down Expand Up @@ -58,9 +59,11 @@ export const deriveAutoGenerateEvents = ({
: {
status: 'SCHEDULE',
// for schedule type of events we want to add the standard interval days to the date
scheduledAt: moment(dateToUseInScheduleStatus)
.add(minDaysFromStart, 'days')
.format('YYYY-MM-DD'),
scheduledAt: convertClientToServer(
moment(dateToUseInScheduleStatus)
.add(minDaysFromStart, 'days')
.format('YYYY-MM-DD'),
dataElementTypes.DATE),
};

return {
Expand Down

0 comments on commit cfc05d3

Please sign in to comment.