diff --git a/src/core_modules/capture-core/utils/converters/date/convertStringToTemporal.js b/src/core_modules/capture-core/utils/converters/date/convertStringToTemporal.js index 5eee8cc7a1..a50c92be11 100644 --- a/src/core_modules/capture-core/utils/converters/date/convertStringToTemporal.js +++ b/src/core_modules/capture-core/utils/converters/date/convertStringToTemporal.js @@ -9,7 +9,13 @@ import { systemSettingsStore } from '../../../metaDataMemoryStores'; * @returns {(Temporal.PlainDate | null)} */ -export function convertStringToTemporal(dateString: string): Temporal.PlainDate | null { +type PlainDate = { + year: number, + month: number, + day: number +}; + +export function convertStringToTemporal(dateString: ?string): PlainDate | null { if (!dateString) { return null; } @@ -34,6 +40,6 @@ export function convertStringToTemporal(dateString: string): Temporal.PlainDate calendar, }); } catch (error) { - return ''; + return null; } } diff --git a/src/core_modules/capture-core/utils/converters/date/convertTemporalToString.js b/src/core_modules/capture-core/utils/converters/date/convertTemporalToString.js index a295b7984d..e413468c66 100644 --- a/src/core_modules/capture-core/utils/converters/date/convertTemporalToString.js +++ b/src/core_modules/capture-core/utils/converters/date/convertTemporalToString.js @@ -1,5 +1,4 @@ // @flow -import { Temporal } from '@js-temporal/polyfill'; import { padWithZeros } from './padWithZeros'; import { systemSettingsStore } from '../../../../capture-core/metaDataMemoryStores'; @@ -9,7 +8,13 @@ import { systemSettingsStore } from '../../../../capture-core/metaDataMemoryStor * @returns {string} Formatted date string, or empty string if invalid */ -export function convertTemporalToString(temporalDate: Temporal.PlainDate | null): string { +type PlainDate = { + year: number, + month: number, + day: number +}; + +export function convertTemporalToString(temporalDate: PlainDate | null): string { if (!temporalDate) { return ''; } diff --git a/src/core_modules/capture-ui/AgeField/AgeField.component.js b/src/core_modules/capture-ui/AgeField/AgeField.component.js index b04b755613..fccf96d0e9 100644 --- a/src/core_modules/capture-ui/AgeField/AgeField.component.js +++ b/src/core_modules/capture-ui/AgeField/AgeField.component.js @@ -28,10 +28,6 @@ type InputMessageClasses = { validating?: ?string, } -type DateParser = (value: string) => { isValid: boolean, momentDate: any }; - -type DateStringFromMomentFormatter = (momentValue: Object) => string; - type ValidationOptions = { error?: ?string, errorCode?: ?string,