implementing Mgrdich's suggestion
This commit is contained in:
parent
387554ebdb
commit
23d937a94c
1 changed files with 6 additions and 14 deletions
|
@ -12,20 +12,12 @@ describe('dateTimeHelpers', () => {
|
|||
|
||||
it('should output the correct date', () => {
|
||||
const date = new Date();
|
||||
const formattedDate = formatTimestamp(date);
|
||||
const formattedTimestamp = formatTimestamp(date.getTime());
|
||||
|
||||
const expected = `${
|
||||
date.getMonth() + 1
|
||||
}/${date.getDate()}/${date.getFullYear()}, ${date
|
||||
.getHours()
|
||||
.toString()
|
||||
.padStart(2, '0')}:${date
|
||||
.getMinutes()
|
||||
.toString()
|
||||
.padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`;
|
||||
expect(formattedDate).toBe(expected);
|
||||
expect(formattedTimestamp).toBe(expected);
|
||||
expect(formatTimestamp(date)).toBe(
|
||||
date.toLocaleString([], { hourCycle: 'h23' })
|
||||
);
|
||||
expect(formatTimestamp(date.getTime())).toBe(
|
||||
date.toLocaleString([], { hourCycle: 'h23' })
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue