Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const enum DateFormatMode {
DateOnly,
MonthAndDayOnly,
MonthAndYearOnly,
FullMonthAndYearOnly,
DateAndTime,
DateAndTimeWithSeconds
}
Expand Down Expand Up @@ -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:
Expand Down