No idea what it is doing... very sad
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
getLocalOffsetFromReference,
|
||||
formatDateTime,
|
||||
toUTCFromLocalInput,
|
||||
parseBackendDateTime,
|
||||
} from '../../src/utils/time';
|
||||
|
||||
describe('formatMinutesAfter', () => {
|
||||
@@ -167,4 +168,29 @@ describe('toUTCFromLocalInput', () => {
|
||||
expect(toUTCFromLocalInput('2026-06-0')).toBe('');
|
||||
});
|
||||
});
|
||||
describe('parseBackendDateTime', () => {
|
||||
it('should parse a UTC string without Z as UTC', () => {
|
||||
const time = '2026-06-04 13:58:00';
|
||||
const date = parseBackendDateTime(time);
|
||||
expect(date.toISOString()).toBe('2026-06-04T13:58:00.000Z');
|
||||
});
|
||||
|
||||
it('should parse a UTC string with Z as UTC', () => {
|
||||
const time = '2026-06-04T13:58:00Z';
|
||||
const date = parseBackendDateTime(time);
|
||||
expect(date.toISOString()).toBe('2026-06-04T13:58:00.000Z');
|
||||
});
|
||||
|
||||
it('should parse a string with an offset correctly', () => {
|
||||
const time = '2026-06-04T13:58:00+02:00';
|
||||
const date = parseBackendDateTime(time);
|
||||
expect(date.toISOString()).toBe('2026-06-04T11:58:00.000Z');
|
||||
});
|
||||
|
||||
it('should handle ISO format with T', () => {
|
||||
const time = '2026-06-04T13:58:00';
|
||||
const date = parseBackendDateTime(time);
|
||||
expect(date.toISOString()).toBe('2026-06-04T13:58:00.000Z');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user