mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
fix: add removed date formats (#2049)
Add date formats that were removed in a prior pull request causing issues with certain API requests.
This commit is contained in:
@ -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);
|
expect(Math.abs(insertedDate.diff(now).minutes)).toBeLessThanOrEqual(1);
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ test('[ORGANISATIONS]: manage document preferences', async ({ page }) => {
|
|||||||
await page.getByRole('option', { name: 'Australia/Perth' }).click();
|
await page.getByRole('option', { name: 'Australia/Perth' }).click();
|
||||||
|
|
||||||
// Set default date
|
// 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.getByRole('option', { name: 'DD/MM/YYYY', exact: true }).click();
|
||||||
|
|
||||||
await page.getByTestId('signature-types-trigger').click();
|
await page.getByTestId('signature-types-trigger').click();
|
||||||
|
|||||||
@ -47,8 +47,8 @@ test('[TEMPLATE]: should create a document from a template', async ({ page }) =>
|
|||||||
|
|
||||||
// Set advanced options.
|
// Set advanced options.
|
||||||
await page.getByRole('button', { name: 'Advanced Options' }).click();
|
await page.getByRole('button', { name: 'Advanced Options' }).click();
|
||||||
await page.locator('button').filter({ hasText: 'YYYY-MM-DD 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').click();
|
await page.getByLabel('DD/MM/YYYY HH:mm', { exact: true }).click();
|
||||||
|
|
||||||
await page.locator('.time-zone-field').click();
|
await page.locator('.time-zone-field').click();
|
||||||
await page.getByRole('option', { name: 'Etc/UTC' }).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.
|
// Set advanced options.
|
||||||
await page.getByRole('button', { name: 'Advanced Options' }).click();
|
await page.getByRole('button', { name: 'Advanced Options' }).click();
|
||||||
await page.locator('button').filter({ hasText: 'YYYY-MM-DD 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').click();
|
await page.getByLabel('DD/MM/YYYY HH:mm', { exact: true }).click();
|
||||||
|
|
||||||
await page.locator('.time-zone-field').click();
|
await page.locator('.time-zone-field').click();
|
||||||
await page.getByRole('option', { name: 'Etc/UTC' }).click();
|
await page.getByRole('option', { name: 'Etc/UTC' }).click();
|
||||||
|
|||||||
@ -2,22 +2,29 @@ import { DateTime } from 'luxon';
|
|||||||
|
|
||||||
import { DEFAULT_DOCUMENT_TIME_ZONE } from './time-zones';
|
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 = [
|
export const VALID_DATE_FORMAT_VALUES = [
|
||||||
DEFAULT_DOCUMENT_DATE_FORMAT,
|
DEFAULT_DOCUMENT_DATE_FORMAT,
|
||||||
'yyyy-MM-dd',
|
'yyyy-MM-dd',
|
||||||
'dd/MM/yyyy',
|
'dd/MM/yyyy',
|
||||||
'MM/dd/yyyy',
|
'MM/dd/yyyy',
|
||||||
'dd.MM.yyyy',
|
|
||||||
'yy-MM-dd',
|
'yy-MM-dd',
|
||||||
'MMMM dd, yyyy',
|
'MMMM dd, yyyy',
|
||||||
'EEEE, MMMM dd, yyyy',
|
'EEEE, MMMM dd, yyyy',
|
||||||
|
'dd/MM/yyyy hh:mm a',
|
||||||
'dd/MM/yyyy HH:mm',
|
'dd/MM/yyyy HH:mm',
|
||||||
|
'MM/dd/yyyy hh:mm a',
|
||||||
'MM/dd/yyyy HH:mm',
|
'MM/dd/yyyy HH:mm',
|
||||||
|
'dd.MM.yyyy',
|
||||||
'dd.MM.yyyy HH:mm',
|
'dd.MM.yyyy HH:mm',
|
||||||
|
'yyyy-MM-dd HH:mm',
|
||||||
|
'yy-MM-dd hh:mm a',
|
||||||
'yy-MM-dd HH:mm',
|
'yy-MM-dd HH:mm',
|
||||||
|
'yyyy-MM-dd HH:mm:ss',
|
||||||
|
'MMMM dd, yyyy hh:mm a',
|
||||||
'MMMM dd, yyyy HH:mm',
|
'MMMM dd, yyyy HH:mm',
|
||||||
|
'EEEE, MMMM dd, yyyy hh:mm a',
|
||||||
'EEEE, MMMM dd, yyyy HH:mm',
|
'EEEE, MMMM dd, yyyy HH:mm',
|
||||||
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
|
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
|
||||||
] as const;
|
] as const;
|
||||||
@ -25,43 +32,76 @@ export const VALID_DATE_FORMAT_VALUES = [
|
|||||||
export type ValidDateFormat = (typeof VALID_DATE_FORMAT_VALUES)[number];
|
export type ValidDateFormat = (typeof VALID_DATE_FORMAT_VALUES)[number];
|
||||||
|
|
||||||
export const DATE_FORMATS = [
|
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',
|
key: 'yyyy-MM-dd_HH:mm',
|
||||||
label: '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',
|
key: 'DDMMYYYY_TIME',
|
||||||
label: 'DD/MM/YYYY HH:mm',
|
label: 'DD/MM/YYYY HH:mm',
|
||||||
value: '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',
|
key: 'MMDDYYYY_TIME',
|
||||||
label: 'MM/DD/YYYY HH:mm',
|
label: 'MM/DD/YYYY HH:mm',
|
||||||
value: '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',
|
key: 'DDMMYYYYHHMM',
|
||||||
label: 'DD.MM.YYYY HH:mm',
|
label: 'DD.MM.YYYY HH:mm',
|
||||||
value: 'dd.MM.yyyy HH:mm',
|
value: 'dd.MM.yyyy HH:mm',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
key: 'YYMMDD_TIME',
|
key: 'YYMMDD_TIME',
|
||||||
label: 'YY-MM-DD HH:mm',
|
label: 'YY-MM-DD HH:mm',
|
||||||
value: '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',
|
key: 'MonthDateYear_TIME',
|
||||||
label: 'Month Date, Year HH:mm',
|
label: 'Month Date, Year HH:mm',
|
||||||
value: 'MMMM dd, yyyy 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',
|
key: 'DayMonthYear_TIME',
|
||||||
label: 'Day, Month Year HH:mm',
|
label: 'Day, Month Year HH:mm',
|
||||||
value: 'EEEE, MMMM dd, yyyy 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',
|
key: 'ISO8601',
|
||||||
label: 'ISO 8601',
|
label: 'ISO 8601',
|
||||||
|
|||||||
Reference in New Issue
Block a user