mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 17:49:05 +03:00
fix(server): timezones (#13262)
This commit is contained in:
@@ -61,6 +61,8 @@ describe(MetadataService.name, () => {
|
||||
tagMock,
|
||||
userMock,
|
||||
} = newTestService(MetadataService));
|
||||
|
||||
delete process.env.TZ;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -275,6 +277,27 @@ describe(MetadataService.name, () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should account for the server being in a non-UTC timezone', async () => {
|
||||
process.env.TZ = 'America/Los_Angeles';
|
||||
assetMock.getByIds.mockResolvedValue([assetStub.sidecar]);
|
||||
metadataMock.readTags.mockResolvedValueOnce({
|
||||
DateTimeOriginal: '2022:01:01 00:00:00',
|
||||
});
|
||||
|
||||
await sut.handleMetadataExtraction({ id: assetStub.image.id });
|
||||
expect(assetMock.upsertExif).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
dateTimeOriginal: new Date('2022-01-01T08:00:00.000Z'),
|
||||
}),
|
||||
);
|
||||
|
||||
expect(assetMock.update).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
localDateTime: new Date('2022-01-01T00:00:00.000Z'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle lists of numbers', async () => {
|
||||
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
||||
metadataMock.readTags.mockResolvedValue({ ISO: [160] });
|
||||
|
||||
Reference in New Issue
Block a user