mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
fix(web): datetime display and add TZ into environment (#618)
* fix(web): timezone * doc(): update readme.md * feat(web): keep using UTC timezone in default * chore(): update doc and remove debug code * chore(): update readme.md * Move timezone into to .env.example * Run prettier check Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
4271e24e59
commit
6abc733763
4 changed files with 21 additions and 6 deletions
|
@ -147,6 +147,7 @@ wget -O .env https://raw.githubusercontent.com/immich-app/immich/main/docker/.en
|
||||||
* Populate `UPLOAD_LOCATION` as prefered location for storing backup assets.
|
* Populate `UPLOAD_LOCATION` as prefered location for storing backup assets.
|
||||||
* Populate a secret value for `JWT_SECRET`, you can use this command: `openssl rand -base64 128`
|
* Populate a secret value for `JWT_SECRET`, you can use this command: `openssl rand -base64 128`
|
||||||
* [Optional] Populate Mapbox value to use reverse geocoding.
|
* [Optional] Populate Mapbox value to use reverse geocoding.
|
||||||
|
* [Optional] Populate `TZ` as your timezone, default is `Etc/UTC`.
|
||||||
|
|
||||||
### Step 3 - Start the containers
|
### Step 3 - Start the containers
|
||||||
|
|
||||||
|
|
|
@ -63,4 +63,12 @@ MAPBOX_KEY=
|
||||||
# Custom message on the login page, should be written in HTML form.
|
# Custom message on the login page, should be written in HTML form.
|
||||||
# For example PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
|
# For example PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
|
||||||
|
|
||||||
PUBLIC_LOGIN_PAGE_MESSAGE=
|
PUBLIC_LOGIN_PAGE_MESSAGE=
|
||||||
|
|
||||||
|
# For correctly display your local time zone on the web, you can set the time zone here.
|
||||||
|
# Should work fine by default value, however, in case of incorrect timezone in EXIF, this value
|
||||||
|
# should be set to the correct timezone.
|
||||||
|
# Command to get timezone:
|
||||||
|
# - Linux: curl -s http://ip-api.com/json/ | grep -oP '(?<=timezone":")(.*?)(?=")'
|
||||||
|
|
||||||
|
# TZ=Etc/UTC
|
|
@ -47,6 +47,8 @@ services:
|
||||||
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
entrypoint: ["/bin/sh", "./entrypoint.sh"]
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
environment:
|
||||||
|
- PUBLIC_TZ=${TZ}
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { createEventDispatcher, onMount } from 'svelte';
|
import { createEventDispatcher, onMount } from 'svelte';
|
||||||
import { browser } from '$app/env';
|
import { browser } from '$app/env';
|
||||||
|
import { env } from '$env/dynamic/public';
|
||||||
import { AssetResponseDto, AlbumResponseDto } from '@api';
|
import { AssetResponseDto, AlbumResponseDto } from '@api';
|
||||||
|
|
||||||
type Leaflet = typeof import('leaflet');
|
type Leaflet = typeof import('leaflet');
|
||||||
|
@ -30,6 +31,13 @@
|
||||||
if (asset.exifInfo?.latitude != null && asset.exifInfo?.longitude != null) {
|
if (asset.exifInfo?.latitude != null && asset.exifInfo?.longitude != null) {
|
||||||
await drawMap(asset.exifInfo.latitude, asset.exifInfo.longitude);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -126,11 +134,7 @@
|
||||||
<p>{moment(asset.exifInfo.dateTimeOriginal).format('MMM DD, YYYY')}</p>
|
<p>{moment(asset.exifInfo.dateTimeOriginal).format('MMM DD, YYYY')}</p>
|
||||||
<div class="flex gap-2 text-sm">
|
<div class="flex gap-2 text-sm">
|
||||||
<p>
|
<p>
|
||||||
{moment(
|
{moment(asset.exifInfo.dateTimeOriginal).format('ddd, hh:mm A')}
|
||||||
asset.exifInfo.dateTimeOriginal
|
|
||||||
.toString()
|
|
||||||
.slice(0, asset.exifInfo.dateTimeOriginal.toString().length - 1)
|
|
||||||
).format('ddd, hh:mm A')}
|
|
||||||
</p>
|
</p>
|
||||||
<p>GMT{moment(asset.exifInfo.dateTimeOriginal).format('Z')}</p>
|
<p>GMT{moment(asset.exifInfo.dateTimeOriginal).format('Z')}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue