2020-03-21 11:56:26 +01:00
|
|
|
import { expect } from 'chai';
|
|
|
|
import { DateFormat } from 'util/formatting/date-format';
|
|
|
|
|
|
|
|
describe('DateFormat', () => {
|
2020-11-26 20:48:43 +01:00
|
|
|
const dt = new Date.UTC(2020, 0, 2, 3, 4, 5, 6);
|
2020-03-21 11:56:26 +01:00
|
|
|
|
|
|
|
it('should format date', () => {
|
2020-11-26 20:48:43 +01:00
|
|
|
expect(DateFormat.dStr(dt)).to.eql('Jan 2, 2020');
|
2020-03-21 11:56:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should format date and time', () => {
|
2020-11-26 20:48:43 +01:00
|
|
|
expect(DateFormat.dtStr(dt)).to.eql('Jan 2, 2020, 03:04:05 AM');
|
2020-03-21 11:56:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should format date and time in sortable format', () => {
|
|
|
|
expect(DateFormat.dtStrFs(dt)).to.eql('2020-01-02T03-04-05');
|
|
|
|
});
|
|
|
|
});
|