1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Use UTC for displaying image timestamps

Fixes #469
This commit is contained in:
mcdamo 2022-04-28 17:44:38 +10:00
parent 3d216fab07
commit 986496786a
2 changed files with 3 additions and 8 deletions

View File

@ -28,10 +28,10 @@
</div> </div>
<div class="col-10"> <div class="col-10">
<div class="details-main"> <div class="details-main">
{{ media.metadata.creationDate | date: (isThisYear() ? 'MMMM d' : 'longDate')}} {{ media.metadata.creationDate | date: (isThisYear() ? 'MMMM d' : 'longDate') : 'UTC' }}
</div> </div>
<div class="details-sub row"> <div class="details-sub row">
<div class="col-12">{{ media.metadata.creationDate | date :'EEEE'}}, {{getTime()}}</div> <div class="col-12">{{ media.metadata.creationDate | date : 'EEEE, HH:mm:ss' : 'UTC' }}</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -150,15 +150,10 @@ export class InfoPanelLightboxComponent implements OnInit, OnChanges {
isThisYear(): boolean { isThisYear(): boolean {
return ( return (
new Date().getFullYear() === new Date().getFullYear() ===
new Date(this.media.metadata.creationDate).getFullYear() new Date(this.media.metadata.creationDate).getUTCFullYear()
); );
} }
getTime(): string {
const date = new Date(this.media.metadata.creationDate);
return date.toTimeString().split(' ')[0];
}
toFraction(f: number): string | number { toFraction(f: number): string | number {
if (f > 1) { if (f > 1) {
return f; return f;