diff --git a/packages/common/src/formatters/__tests__/dateEuroShortFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateEuroShortFormatter.spec.ts new file mode 100644 index 000000000..79a3a066b --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateEuroShortFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateEuroShort Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateEuroShort(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('1/5/19'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeEuroAM_PMFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeEuroAM_PMFormatter.spec.ts new file mode 100644 index 000000000..35582603b --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeEuroAM_PMFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeEuroAM_PM Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeEuroAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeEuroAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeEuroAM_PM(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('01/05/2019 02:36:07 AM'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeEuroAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('01/05/2019 02:36:07 AM'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeEuroAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('01/05/2019 08:36:07 PM'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeEuroShortAM_PMFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeEuroShortAM_PMFormatter.spec.ts new file mode 100644 index 000000000..a0048e9fe --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeEuroShortAM_PMFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeEuroShortAM_PM Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeEuroShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeEuroShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeEuroShortAM_PM(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('1/5/19 2:36:7 AM'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeEuroShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19 2:36:7 AM'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeEuroShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19 8:36:7 PM'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeEuroShortAmPmFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeEuroShortAmPmFormatter.spec.ts new file mode 100644 index 000000000..79fe87bf8 --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeEuroShortAmPmFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeEuroShortAmPm Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeEuroShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeEuroShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeEuroShortAmPm(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('1/5/19 2:36:7 am'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeEuroShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19 2:36:7 am'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeEuroShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19 8:36:7 pm'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeEuroShortFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeEuroShortFormatter.spec.ts new file mode 100644 index 000000000..5fa2d03d4 --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeEuroShortFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeEuroShort Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeEuroShort(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('1/5/19 2:36:7'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19 2:36:7'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeEuroShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('1/5/19 20:36:7'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeIsoAM_PMFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeIsoAM_PMFormatter.spec.ts new file mode 100644 index 000000000..d841159e9 --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeIsoAM_PMFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeIsoAM_PM Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeIsoAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeIsoAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeIsoAM_PM(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('2019-05-01 02:36:07 AM'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeIsoAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('2019-05-01 02:36:07 AM'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeIsoAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('2019-05-01 08:36:07 PM'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeUsAM_PMFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeUsAM_PMFormatter.spec.ts new file mode 100644 index 000000000..d0df34c4e --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeUsAM_PMFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeUsAM_PM Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeUsAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeUsAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeUsAM_PM(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('05/01/2019 02:36:07 AM'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeUsAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('05/01/2019 02:36:07 AM'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeUsAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('05/01/2019 08:36:07 PM'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeUsShortAM_PMFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeUsShortAM_PMFormatter.spec.ts new file mode 100644 index 000000000..58363f1f4 --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeUsShortAM_PMFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeUsShortAM_PM Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeUsShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeUsShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeUsShortAM_PM(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('5/1/19 2:36:7 AM'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeUsShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19 2:36:7 AM'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeUsShortAM_PM(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19 8:36:7 PM'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeUsShortAmPmFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeUsShortAmPmFormatter.spec.ts new file mode 100644 index 000000000..7ffcb961a --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeUsShortAmPmFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeUsShortAmPm Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeUsShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeUsShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeUsShortAmPm(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('5/1/19 2:36:7 am'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeUsShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19 2:36:7 am'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeUsShortAmPm(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19 8:36:7 pm'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateTimeUsShortFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateTimeUsShortFormatter.spec.ts new file mode 100644 index 000000000..0ca980ad7 --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateTimeUsShortFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateTimeUsShort Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateTimeUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateTimeUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateTimeUsShort(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('5/1/19 2:36:7'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateTimeUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19 2:36:7'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateTimeUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19 20:36:7'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateUsShortFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateUsShortFormatter.spec.ts new file mode 100644 index 000000000..eeba6e7f1 --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateUsShortFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateUsShort Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = '2019-05-01 02:36:07'; + const result = Formatters.dateUsShort(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('5/1/19'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07'); + const result = Formatters.dateUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07'); + const result = Formatters.dateUsShort(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('5/1/19'); + }); +}); diff --git a/packages/common/src/formatters/__tests__/dateUtcFormatter.spec.ts b/packages/common/src/formatters/__tests__/dateUtcFormatter.spec.ts new file mode 100644 index 000000000..e6369c5d1 --- /dev/null +++ b/packages/common/src/formatters/__tests__/dateUtcFormatter.spec.ts @@ -0,0 +1,34 @@ +import { Column } from '../../interfaces/index'; +import { Formatters } from '../index'; + +describe('the DateUtc Formatter', () => { + it('should return null when no value is provided', () => { + const value = null; + const result = Formatters.dateUtc(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe(null); + }); + + it('should return original string when input value provided is not a valid date', () => { + const value = 'TBD'; + const result = Formatters.dateUtc(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('TBD'); + }); + + it('should provide a dateIso formatted input and return a formatted date value without time when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07Z'); + const result = Formatters.dateUtc(0, 0, value, { type: 'dateIso' } as unknown as Column, {}, {} as any); + expect(result).toBe('2019-04-30T21:36:07.000-05:00'); + }); + + it('should return a formatted date value in the morning when valid date value is provided', () => { + const value = new Date('2019-05-01T02:36:07Z'); + const result = Formatters.dateUtc(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('2019-04-30T21:36:07.000-05:00'); + }); + + it('should return a formatted date value in the afternoon when valid date value is provided', () => { + const value = new Date('2019-05-01T20:36:07Z'); + const result = Formatters.dateUtc(0, 0, value, {} as Column, {}, {} as any); + expect(result).toBe('2019-05-01T15:36:07.000-05:00'); + }); +}); diff --git a/packages/common/src/formatters/formatters.index.ts b/packages/common/src/formatters/formatters.index.ts index bd65e4c6a..d6b37b6bd 100644 --- a/packages/common/src/formatters/formatters.index.ts +++ b/packages/common/src/formatters/formatters.index.ts @@ -134,18 +134,36 @@ export const Formatters = { /** Takes a Date object and displays it as an ISO Date+Time+(am/pm) format (YYYY-MM-DD h:mm:ss a) */ dateTimeIsoAmPm: getAssociatedDateFormatter(FieldType.dateTimeIsoAmPm, '-'), + /** Takes a Date object and displays it as an ISO Date+Time+(AM/PM) format (YYYY-MM-DD hh:mm:ss A) */ + dateTimeIsoAM_PM: getAssociatedDateFormatter(FieldType.dateTimeIsoAM_PM, '-'), + /** Takes a Date object and displays it as an Euro Date format (DD/MM/YYYY) */ dateEuro: getAssociatedDateFormatter(FieldType.dateEuro, '/'), + /** Takes a Date object and displays it as an Euro Date format (D/M/YY) */ + dateEuroShort: getAssociatedDateFormatter(FieldType.dateEuroShort, '/'), + /** Takes a Date object and displays it as an Euro Date+Time format (DD/MM/YYYY HH:mm:ss) */ dateTimeEuro: getAssociatedDateFormatter(FieldType.dateTimeEuro, '/'), + /** Takes a Date object and displays it as an Euro Date+Time format (D/M/YY H:m:s) */ + dateTimeEuroShort: getAssociatedDateFormatter(FieldType.dateTimeEuroShort, '/'), + /** Takes a Date object and displays it as an Euro Date+Time (without seconds) format (DD/MM/YYYY HH:mm) */ dateTimeShortEuro: getAssociatedDateFormatter(FieldType.dateTimeShortEuro, '/'), /** Takes a Date object and displays it as an Euro Date+Time+(am/pm) format (DD/MM/YYYY hh:mm:ss a) */ dateTimeEuroAmPm: getAssociatedDateFormatter(FieldType.dateTimeEuroAmPm, '/'), + /** Takes a Date object and displays it as an Euro Date+Time+(AM/PM) format (DD/MM/YYYY hh:mm:ss A) */ + dateTimeEuroAM_PM: getAssociatedDateFormatter(FieldType.dateTimeEuroAM_PM, '/'), + + /** Takes a Date object and displays it as an Euro Date+Time+(am/pm) format (D/M/YY h:m:s a) */ + dateTimeEuroShortAmPm: getAssociatedDateFormatter(FieldType.dateTimeEuroShortAmPm, '/'), + + /** Takes a Date object and displays it as an Euro Date+Time+(am/pm) format (D/M/YY h:m:s A) */ + dateTimeEuroShortAM_PM: getAssociatedDateFormatter(FieldType.dateTimeEuroShortAM_PM, '/'), + /** Takes a Date object and displays it as an US Date format (MM/DD/YYYY) */ dateUs: getAssociatedDateFormatter(FieldType.dateUs, '/'), @@ -158,6 +176,24 @@ export const Formatters = { /** Takes a Date object and displays it as an US Date+Time+(am/pm) format (MM/DD/YYYY hh:mm:ss a) */ dateTimeUsAmPm: getAssociatedDateFormatter(FieldType.dateTimeUsAmPm, '/'), + /** Takes a Date object and displays it as an US Date+Time+(AM/PM) format (MM/DD/YYYY hh:mm:ss A) */ + dateTimeUsAM_PM: getAssociatedDateFormatter(FieldType.dateTimeUsAM_PM, '/'), + + /** Takes a Date object and displays it as an US Date+Time format (M/D/YY H:m:s) */ + dateTimeUsShort: getAssociatedDateFormatter(FieldType.dateTimeUsShort, '/'), + + /** Takes a Date object and displays it as an US Date+Time+(am/pm) format (M/D/YY h:m:s a) */ + dateTimeUsShortAmPm: getAssociatedDateFormatter(FieldType.dateTimeUsShortAmPm, '/'), + + /** Takes a Date object and displays it as an US Date+Time+(AM/PM) format (M/D/YY h:m:s A) */ + dateTimeUsShortAM_PM: getAssociatedDateFormatter(FieldType.dateTimeUsShortAM_PM, '/'), + + /** Takes a Date object and displays it as an US Date format (M/D/YY) */ + dateUsShort: getAssociatedDateFormatter(FieldType.dateUsShort, '/'), + + /** Takes a Date object and displays it as a regular TZ timestamp format (YYYY-MM-DDTHH:mm:ss.SSSZ) */ + dateUtc: getAssociatedDateFormatter(FieldType.dateUtc, '-'), + /** Displays a Font-Awesome delete icon (fa-trash) */ deleteIcon: deleteIconFormatter, diff --git a/packages/common/src/services/utilities.ts b/packages/common/src/services/utilities.ts index 1d0af98de..b3eba3bea 100644 --- a/packages/common/src/services/utilities.ts +++ b/packages/common/src/services/utilities.ts @@ -368,6 +368,9 @@ export function mapMomentDateFormatWithFieldType(fieldType: typeof FieldType[key case FieldType.dateTimeEuroShortAmPm: map = 'D/M/YY h:m:s a'; break; + case FieldType.dateTimeEuroShortAM_PM: + map = 'D/M/YY h:m:s A'; + break; // all US Formats (month/date/year) case FieldType.dateUs: map = 'MM/DD/YYYY'; @@ -390,6 +393,9 @@ export function mapMomentDateFormatWithFieldType(fieldType: typeof FieldType[key case FieldType.dateTimeUsShortAmPm: map = 'M/D/YY h:m:s a'; break; + case FieldType.dateTimeUsShortAM_PM: + map = 'M/D/YY h:m:s A'; + break; case FieldType.dateTimeShortUs: map = 'MM/DD/YYYY HH:mm'; break;