diff --git a/src/routes/plans/+page.svelte b/src/routes/plans/+page.svelte index 42a5e15ee0..e8229ddf69 100644 --- a/src/routes/plans/+page.svelte +++ b/src/routes/plans/+page.svelte @@ -495,12 +495,12 @@ planTags = [...importedPlanTags.existingTags, ...newTags]; // remove the `+00:00` timezone before parsing - const startTime = `${convertDoyToYmd(planJSON.start_time.replace(/\+00:00/, ''))}Z`; + const startTime = `${convertDoyToYmd(planJSON.start_time.replace(/\+00:00/, ''))}`; await startTimeField.validateAndSet(getDoyTime(new Date(startTime), true)); if (isDeprecatedPlanTransfer(planJSON)) { await endTimeField.validateAndSet( - getDoyTime(new Date(`${convertDoyToYmd(planJSON.end_time.replace(/\+00:00/, ''))}Z`), true), + getDoyTime(new Date(`${convertDoyToYmd(planJSON.end_time.replace(/\+00:00/, ''))}`), true), ); } else { const { duration } = planJSON; diff --git a/src/utilities/time.test.ts b/src/utilities/time.test.ts index bec63c07f3..70e0c45bc5 100644 --- a/src/utilities/time.test.ts +++ b/src/utilities/time.test.ts @@ -202,6 +202,7 @@ test('convertDoyToYmd', () => { expect(convertDoyToYmd('2023-001T00:00:00', false)).toEqual('2023-01-01T00:00:00Z'); expect(convertDoyToYmd('2023-032T00:00:00', false)).toEqual('2023-02-01T00:00:00Z'); expect(convertDoyToYmd('2023-048T10:32:44.123', true)).toEqual('2023-02-17T10:32:44.123Z'); + expect(convertDoyToYmd('2023-04-10T10:32:44.123', true)).toEqual('2023-04-10T10:32:44.123Z'); }); test('getDaysInMonth', () => { diff --git a/src/utilities/time.ts b/src/utilities/time.ts index d40b073224..2d1c3ab2d9 100644 --- a/src/utilities/time.ts +++ b/src/utilities/time.ts @@ -383,7 +383,7 @@ export function convertDoyToYmd(doyString: string, includeMsecs = true): string return `${ymdString.replace(/(\.\d+)/, '')}Z`; } else { // doyString is already in ymd format - return doyString; + return `${doyString}Z`; } }