diff --git a/apps/client/src/common/utils/dateConfig.ts b/apps/client/src/common/utils/dateConfig.ts index e0f091544..3e027e2da 100644 --- a/apps/client/src/common/utils/dateConfig.ts +++ b/apps/client/src/common/utils/dateConfig.ts @@ -85,8 +85,13 @@ function inferSeparators(value: string, isAM: boolean, isPM: boolean) { } } else if (length === 2) { if (isPM || isAM) { - inferredMillis = parse(value) * MILLIS_PER_HOUR; - if (isAM || (isPM && value === '12')) { + if (value === '12' && isAM) { + inferredMillis = 0; + } else { + inferredMillis = parse(value) * MILLIS_PER_HOUR; + } + + if (isAM || value === '12') { // this ensures we dont add 12 hours in the end addAM = 12; } @@ -114,10 +119,6 @@ function inferSeparators(value: string, isAM: boolean, isPM: boolean) { export const forgivingStringToMillis = (value: string): number => { value = value.toLowerCase(); - if (value === '12am' || value === '12a') { - return 0; - } - const { isAM, isPM, value: parsingValue } = checkAmPm(value); const maybeMillisFromMatchers = checkMatchers(parsingValue); if (maybeMillisFromMatchers !== null) {