From d92a7834355f65af34f1c3cbced4bca5a6483d10 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 28 Nov 2023 09:25:14 +0100 Subject: [PATCH] fix: ensure date-time is ISO format --- examples/data/ldcE.ts | 2 +- examples/data/ldcP.ts | 2 +- examples/data/planningPermission.ts | 2 +- examples/data/priorApproval.ts | 2 +- schema/schema.json | 2 ++ types/utils.ts | 2 ++ 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/data/ldcE.ts b/examples/data/ldcE.ts index 20319dde..4961b730 100644 --- a/examples/data/ldcE.ts +++ b/examples/data/ldcE.ts @@ -1234,7 +1234,7 @@ export const validLDCE: Schema = { flowId: '824628b2-deeb-48b0-92b1-2ca7f3b17163', url: 'https://www.editor.planx.dev/buckinghamshire/apply-for-a-lawful-development-certificate/preview', }, - submittedAt: '2023-10-02 00:00:00', + submittedAt: '2023-10-02T00:00:00.000Z', schema: 'https://theopensystemslab.github.io/digital-planning-data-schemas/@next/schema.json', }, diff --git a/examples/data/ldcP.ts b/examples/data/ldcP.ts index 500b8f76..3e1136b1 100644 --- a/examples/data/ldcP.ts +++ b/examples/data/ldcP.ts @@ -838,7 +838,7 @@ export const validLDCP: Schema = { flowId: '824628b2-deeb-48b0-92b1-2ca7f3b17163', url: 'https://www.editor.planx.dev/buckinghamshire/apply-for-a-lawful-development-certificate/preview', }, - submittedAt: '2023-10-02 00:00:00', + submittedAt: '2023-10-02T00:00:00.000Z', schema: 'https://theopensystemslab.github.io/digital-planning-data-schemas/@next/schema.json', }, diff --git a/examples/data/planningPermission.ts b/examples/data/planningPermission.ts index 46c73920..14daf902 100644 --- a/examples/data/planningPermission.ts +++ b/examples/data/planningPermission.ts @@ -1256,7 +1256,7 @@ export const validPlanningPermission: Schema = { flowId: '01e38c5d-e701-4e44-acdc-4d6b5cc3b854', url: 'https://www.editor.planx.dev/lambeth/apply-for-planning-permission/preview', }, - submittedAt: '2023-10-02 00:00:00', + submittedAt: '2023-10-02T00:00:00.000Z', schema: 'https://theopensystemslab.github.io/digital-planning-data-schemas/@next/schema.json', }, diff --git a/examples/data/priorApproval.ts b/examples/data/priorApproval.ts index 406b6632..baf98f2a 100644 --- a/examples/data/priorApproval.ts +++ b/examples/data/priorApproval.ts @@ -774,7 +774,7 @@ export const validPriorApproval: Schema = { flowId: 'c6628103-c648-4663-81e1-bfa0a1a18340', url: 'https://www.editor.planx.dev/southwark/apply-for-prior-approval/preview', }, - submittedAt: '2023-10-02 00:00:00', + submittedAt: '2023-10-02T00:00:00.000Z', schema: 'https://theopensystemslab.github.io/digital-planning-data-schemas/@next/schema.json', }, diff --git a/schema/schema.json b/schema/schema.json index 5896dcb4..1ccf29d4 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -1227,7 +1227,9 @@ "type": "string" }, "DateTime": { + "description": "Regex-based implementation of iso-date-time until available in ajv-formats@3.0.0", "format": "date-time", + "pattern": "^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])\\.[0-9]{3}Z$", "type": "string" }, "Email": { diff --git a/types/utils.ts b/types/utils.ts index 07574b8a..b79c4633 100644 --- a/types/utils.ts +++ b/types/utils.ts @@ -18,6 +18,8 @@ export type URL = string; /** * @format date-time + * @pattern ^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])\.[0-9]{3}Z$ + * @description Regex-based implementation of iso-date-time until available in ajv-formats@3.0.0 */ export type DateTime = string;