Download lib/utils/timezone.test.ts from ASEM12345/rsshub: direct link, hf CLI and curl.
- Browser
- Download file 596 Bytes
-
https://huggingface.co/spaces/ASEM12345/rsshub/resolve/main/lib/utils/timezone.test.ts
- Command line
-
hf download hf://spaces/ASEM12345/rsshub/lib/utils/timezone.test.ts
-
curl -L -o timezone.test.ts https://huggingface.co/spaces/ASEM12345/rsshub/resolve/main/lib/utils/timezone.test.ts
596 Bytes
| import { describe, expect, it } from 'vitest'; | |
| import timezone from '@/utils/timezone'; | |
| describe('timezone', () => { | |
| it('timezone', () => { | |
| const serverTimezone = -new Date().getTimezoneOffset() / 60; | |
| expect(timezone(new Date('2024-01-01T01:01:01Z'), serverTimezone - 1).toISOString()).toEqual('2024-01-01T02:01:01.000Z'); | |
| }); | |
| it('timezone with string input', () => { | |
| const serverTimezone = -new Date().getTimezoneOffset() / 60; | |
| expect(timezone('2024-01-01T01:01:01Z', serverTimezone).toISOString()).toEqual('2024-01-01T01:01:01.000Z'); | |
| }); | |
| }); | |