diff --git a/projects/common/src/utilities/formatters/date/date-formatter.test.ts b/projects/common/src/utilities/formatters/date/date-formatter.test.ts index 7ab1eccad..192062b1a 100644 --- a/projects/common/src/utilities/formatters/date/date-formatter.test.ts +++ b/projects/common/src/utilities/formatters/date/date-formatter.test.ts @@ -14,4 +14,12 @@ describe('Date formatter', () => { }).format(dateString) ).toEqual('Aug 21'); }); + + test('can format a date string with full month and year only', () => { + expect( + new DateFormatter({ + mode: DateFormatMode.FullMonthAndYearOnly + }).format(dateString) + ).toEqual('August 2021'); + }); }); diff --git a/projects/common/src/utilities/formatters/date/date-formatter.ts b/projects/common/src/utilities/formatters/date/date-formatter.ts index 7ec594930..72e9d7e65 100644 --- a/projects/common/src/utilities/formatters/date/date-formatter.ts +++ b/projects/common/src/utilities/formatters/date/date-formatter.ts @@ -8,6 +8,7 @@ export const enum DateFormatMode { DateOnly, MonthAndDayOnly, MonthAndYearOnly, + FullMonthAndYearOnly, DateAndTime, DateAndTimeWithSeconds } @@ -54,6 +55,8 @@ export class DateFormatter { return 'MMM d'; case DateFormatMode.MonthAndYearOnly: return 'MMM yy'; + case DateFormatMode.FullMonthAndYearOnly: + return 'MMMM yyyy'; case DateFormatMode.DateOnly: return 'd MMM y'; case DateFormatMode.DateAndTime: