1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-24 04:46:50 +02:00

fix(server,web,mobile): Incorrectly record and show timestamp and time zone of the asset (#706)

Implemented a mechanism to extract the correct time zone from the GPS coordinate if presented in the file's EXIF, and to convert the timestamp to the correct UTC time so that the time will show correctly based on the mobile/web local time zone.
This commit is contained in:
Alex
2022-09-22 15:58:17 -05:00
committed by GitHub
parent fc194021a4
commit e5459b68ff
16 changed files with 392 additions and 63 deletions

View File

@ -7,7 +7,6 @@
import moment from 'moment';
import { createEventDispatcher, onMount } from 'svelte';
import { browser } from '$app/environment';
import { env } from '$env/dynamic/public';
import { AssetResponseDto, AlbumResponseDto } from '@api';
type Leaflet = typeof import('leaflet');
@ -31,13 +30,6 @@
if (asset.exifInfo?.latitude != null && asset.exifInfo?.longitude != null) {
await drawMap(asset.exifInfo.latitude, asset.exifInfo.longitude);
}
// remove timezone when user not config PUBLIC_TZ var. Etc/UTC is used in default.
if (asset.exifInfo?.dateTimeOriginal && !env.PUBLIC_TZ) {
const dateTimeOriginal = asset.exifInfo.dateTimeOriginal;
asset.exifInfo.dateTimeOriginal = dateTimeOriginal.slice(0, dateTimeOriginal.length - 1);
}
}
});

View File

@ -12,6 +12,7 @@ export const load: PageServerLoad = async ({ parent }) => {
user
};
} catch (e) {
console.log('Photo page load error', e);
throw redirect(302, '/auth/login');
}
};