mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 05:56:53 +00:00
77dddd5e8a
Release branch for 4.0.0.
18 lines
771 B
TypeScript
18 lines
771 B
TypeScript
import { localParts, resolveTimeZone } from '../../../src/nest/common/timezoneService';
|
|
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('timezoneService', () => {
|
|
it('resolves valid coordinates and rejects missing or invalid values', () => {
|
|
expect(resolveTimeZone(35.6762, 139.6503)).toBe('Asia/Tokyo');
|
|
expect(resolveTimeZone(null, 139.6503)).toBeNull();
|
|
expect(resolveTimeZone(91, 139.6503)).toBeNull();
|
|
});
|
|
|
|
it('converts instants to local date and time', () => {
|
|
expect(localParts('2026-12-03T00:00:00Z', 'Asia/Tokyo')).toEqual({ date: '2026-12-03', time: '09:00' });
|
|
expect(localParts('invalid', 'Asia/Tokyo')).toEqual({ date: null, time: null });
|
|
expect(localParts(null, null)).toEqual({ date: null, time: null });
|
|
});
|
|
});
|