mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(web): shared link date range (#15802)
This commit is contained in:
parent
844eed8707
commit
c016b65ef2
3 changed files with 57 additions and 25 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { timeToSeconds } from './date-time';
|
||||
import { writable } from 'svelte/store';
|
||||
import { getAlbumDateRange, timeToSeconds } from './date-time';
|
||||
|
||||
describe('converting time to seconds', () => {
|
||||
it('parses hh:mm:ss correctly', () => {
|
||||
|
|
@ -21,3 +22,30 @@ describe('converting time to seconds', () => {
|
|||
expect(timeToSeconds('01:02:03.456.123456')).toBeCloseTo(3723.456);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getAlbumDate', () => {
|
||||
beforeAll(() => {
|
||||
process.env.TZ = 'UTC';
|
||||
|
||||
vitest.mock('$lib/stores/preferences.store', () => ({
|
||||
locale: writable('en'),
|
||||
}));
|
||||
});
|
||||
|
||||
it('should work with only a start date', () => {
|
||||
expect(getAlbumDateRange({ startDate: '2021-01-01T00:00:00Z' })).toEqual('Jan 1, 2021');
|
||||
});
|
||||
|
||||
it('should work with a start and end date', () => {
|
||||
expect(
|
||||
getAlbumDateRange({
|
||||
startDate: '2021-01-01T00:00:00Z',
|
||||
endDate: '2021-01-05T00:00:00Z',
|
||||
}),
|
||||
).toEqual('Jan 1, 2021 - Jan 5, 2021');
|
||||
});
|
||||
|
||||
it('should work with the new date format', () => {
|
||||
expect(getAlbumDateRange({ startDate: '2021-01-01T00:00:00+05:00' })).toEqual('Jan 1, 2021');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue