mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge pull request #1947 from 4Science/CST-7376
Test cases of date.util.spec.ts fixed
This commit is contained in:
@@ -22,7 +22,7 @@ describe('Date Utils', () => {
|
||||
});
|
||||
it('should convert NgbDateStruct to YYYY-MM-DDThh:mm:ssZ string', () => {
|
||||
// NOTE: month is zero indexed which is why it increases by one
|
||||
const date = new Date(2022, 5, 3);
|
||||
const date = new Date(Date.UTC(2022, 5, 3));
|
||||
expect(dateToISOFormat(dateToNgbDateStruct(date))).toEqual('2022-06-03T00:00:00Z');
|
||||
});
|
||||
});
|
||||
@@ -30,22 +30,22 @@ describe('Date Utils', () => {
|
||||
describe('dateToString', () => {
|
||||
it('should convert Date to YYYY-MM-DD string', () => {
|
||||
// NOTE: month is zero indexed which is why it increases by one
|
||||
expect(dateToString(new Date(2022, 5, 3))).toEqual('2022-06-03');
|
||||
expect(dateToString(new Date(Date.UTC(2022, 5, 3)))).toEqual('2022-06-03');
|
||||
});
|
||||
it('should convert Date with time to YYYY-MM-DD string', () => {
|
||||
// NOTE: month is zero indexed which is why it increases by one
|
||||
expect(dateToString(new Date(2022, 5, 3, 3, 24, 0))).toEqual('2022-06-03');
|
||||
expect(dateToString(new Date(Date.UTC(2022, 5, 3, 3, 24, 0)))).toEqual('2022-06-03');
|
||||
});
|
||||
it('should convert Month only to YYYY-MM-DD string', () => {
|
||||
// NOTE: month is zero indexed which is why it increases by one
|
||||
expect(dateToString(new Date(2022, 5))).toEqual('2022-06-01');
|
||||
expect(dateToString(new Date(Date.UTC(2022, 5)))).toEqual('2022-06-01');
|
||||
});
|
||||
it('should convert ISO Date to YYYY-MM-DD string', () => {
|
||||
expect(dateToString(new Date('2022-06-03T03:24:00Z'))).toEqual('2022-06-03');
|
||||
});
|
||||
it('should convert NgbDateStruct to YYYY-MM-DD string', () => {
|
||||
// NOTE: month is zero indexed which is why it increases by one
|
||||
const date = new Date(2022, 5, 3);
|
||||
const date = new Date(Date.UTC(2022, 5, 3));
|
||||
expect(dateToString(dateToNgbDateStruct(date))).toEqual('2022-06-03');
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user