The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
fix: add removed date formats (#2049)
Lucas Smith681540b5017c
diff --git a/packages/app-tests/e2e/document-flow/stepper-component.spec.ts b/packages/app-tests/e2e/document-flow/stepper-component.spec.tsindex 59d80d1b6..06251175e 100644--- a/packages/app-tests/e2e/document-flow/stepper-component.spec.ts+++ b/packages/app-tests/e2e/document-flow/stepper-component.spec.ts@@ -504,7 +504,7 @@ test('[DOCUMENT_FLOW]: should be able to sign a document with custom date', asyn},});- const insertedDate = DateTime.fromFormat(field?.customText ?? '', 'yyyy-MM-dd HH:mm');+ const insertedDate = DateTime.fromFormat(field?.customText ?? '', 'yyyy-MM-dd hh:mm a');expect(Math.abs(insertedDate.diff(now).minutes)).toBeLessThanOrEqual(1);diff --git a/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.ts b/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.tsindex c946062ec..f577ab3e1 100644--- a/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.ts+++ b/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.ts@@ -30,7 +30,7 @@ test('[ORGANISATIONS]: manage document preferences', async ({ page }) => {await page.getByRole('option', { name: 'Australia/Perth' }).click();// Set default date- await page.getByRole('combobox').filter({ hasText: 'yyyy-MM-dd HH:mm' }).click();+ await page.getByRole('combobox').filter({ hasText: 'yyyy-MM-dd hh:mm AM/PM' }).click();await page.getByRole('option', { name: 'DD/MM/YYYY', exact: true }).click();await page.getByTestId('signature-types-trigger').click();diff --git a/packages/app-tests/e2e/templates/create-document-from-template.spec.ts b/packages/app-tests/e2e/templates/create-document-from-template.spec.tsindex acafc9274..df5d1aa87 100644--- a/packages/app-tests/e2e/templates/create-document-from-template.spec.ts+++ b/packages/app-tests/e2e/templates/create-document-from-template.spec.ts@@ -47,8 +47,8 @@ test('[TEMPLATE]: should create a document from a template', async ({ page }) =>// Set advanced options.await page.getByRole('button', { name: 'Advanced Options' }).click();- await page.locator('button').filter({ hasText: 'YYYY-MM-DD HH:mm' }).click();- await page.getByLabel('DD/MM/YYYY HH:mm').click();+ await page.locator('button').filter({ hasText: 'YYYY-MM-DD hh:mm AM/PM' }).click();+ await page.getByLabel('DD/MM/YYYY HH:mm', { exact: true }).click();await page.locator('.time-zone-field').click();await page.getByRole('option', { name: 'Etc/UTC' }).click();@@ -150,8 +150,8 @@ test('[TEMPLATE]: should create a team document from a team template', async ({// Set advanced options.await page.getByRole('button', { name: 'Advanced Options' }).click();- await page.locator('button').filter({ hasText: 'YYYY-MM-DD HH:mm' }).click();- await page.getByLabel('DD/MM/YYYY HH:mm').click();+ await page.locator('button').filter({ hasText: 'YYYY-MM-DD hh:mm AM/PM' }).click();+ await page.getByLabel('DD/MM/YYYY HH:mm', { exact: true }).click();await page.locator('.time-zone-field').click();await page.getByRole('option', { name: 'Etc/UTC' }).click();diff --git a/packages/lib/constants/date-formats.ts b/packages/lib/constants/date-formats.tsindex a02030a45..1f9b75929 100644--- a/packages/lib/constants/date-formats.ts+++ b/packages/lib/constants/date-formats.ts@@ -2,22 +2,29 @@ import { DateTime } from 'luxon';import { DEFAULT_DOCUMENT_TIME_ZONE } from './time-zones';-export const DEFAULT_DOCUMENT_DATE_FORMAT = 'yyyy-MM-dd HH:mm';+export const DEFAULT_DOCUMENT_DATE_FORMAT = 'yyyy-MM-dd hh:mm a';export const VALID_DATE_FORMAT_VALUES = [DEFAULT_DOCUMENT_DATE_FORMAT,'yyyy-MM-dd','dd/MM/yyyy','MM/dd/yyyy',- 'dd.MM.yyyy','yy-MM-dd','MMMM dd, yyyy','EEEE, MMMM dd, yyyy',+ 'dd/MM/yyyy hh:mm a','dd/MM/yyyy HH:mm',+ 'MM/dd/yyyy hh:mm a','MM/dd/yyyy HH:mm',+ 'dd.MM.yyyy','dd.MM.yyyy HH:mm',+ 'yyyy-MM-dd HH:mm',+ 'yy-MM-dd hh:mm a','yy-MM-dd HH:mm',+ 'yyyy-MM-dd HH:mm:ss',+ 'MMMM dd, yyyy hh:mm a','MMMM dd, yyyy HH:mm',+ 'EEEE, MMMM dd, yyyy hh:mm a','EEEE, MMMM dd, yyyy HH:mm',"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",] as const;@@ -25,43 +32,76 @@ export const VALID_DATE_FORMAT_VALUES = [export type ValidDateFormat = (typeof VALID_DATE_FORMAT_VALUES)[number];export const DATE_FORMATS = [+ {+ key: 'yyyy-MM-dd_HH:mm_12H',+ label: 'YYYY-MM-DD hh:mm AM/PM',+ value: DEFAULT_DOCUMENT_DATE_FORMAT,+ },{key: 'yyyy-MM-dd_HH:mm',label: 'YYYY-MM-DD HH:mm',- value: DEFAULT_DOCUMENT_DATE_FORMAT,+ value: 'yyyy-MM-dd HH:mm',},{key: 'DDMMYYYY_TIME',label: 'DD/MM/YYYY HH:mm',value: 'dd/MM/yyyy HH:mm',},+ {+ key: 'DDMMYYYY_TIME_12H',+ label: 'DD/MM/YYYY HH:mm AM/PM',+ value: 'dd/MM/yyyy hh:mm a',+ },{key: 'MMDDYYYY_TIME',label: 'MM/DD/YYYY HH:mm',value: 'MM/dd/yyyy HH:mm',},+ {+ key: 'MMDDYYYY_TIME_12H',+ label: 'MM/DD/YYYY HH:mm AM/PM',+ value: 'MM/dd/yyyy hh:mm a',+ },{key: 'DDMMYYYYHHMM',label: 'DD.MM.YYYY HH:mm',value: 'dd.MM.yyyy HH:mm',},-{key: 'YYMMDD_TIME',label: 'YY-MM-DD HH:mm',value: 'yy-MM-dd HH:mm',},-+ {+ key: 'YYMMDD_TIME_12H',+ label: 'YY-MM-DD HH:mm AM/PM',+ value: 'yy-MM-dd hh:mm a',+ },+ {+ key: 'YYYY_MM_DD_HH_MM_SS',+ label: 'YYYY-MM-DD HH:mm:ss',+ value: 'yyyy-MM-dd HH:mm:ss',+ },{key: 'MonthDateYear_TIME',label: 'Month Date, Year HH:mm',value: 'MMMM dd, yyyy HH:mm',},+ {+ key: 'MonthDateYear_TIME_12H',+ label: 'Month Date, Year HH:mm AM/PM',+ value: 'MMMM dd, yyyy hh:mm a',+ },{key: 'DayMonthYear_TIME',label: 'Day, Month Year HH:mm',value: 'EEEE, MMMM dd, yyyy HH:mm',},+ {+ key: 'DayMonthYear_TIME_12H',+ label: 'Day, Month Year HH:mm AM/PM',+ value: 'EEEE, MMMM dd, yyyy hh:mm a',+ },{key: 'ISO8601',label: 'ISO 8601',