1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-27 14:28:53 +09:00

fix: 広告のexpiresAtをLocalTZ分ずらして初期化 (#9876)

* fix: 広告のexpiresAtをLocalTZ分ずらして初期化

* chore: 不要なインポートを削除
This commit is contained in:
KOKO 2023-02-12 08:23:14 +09:00 committed by GitHub
parent f28aea9e30
commit ac7e2ecb59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,11 +60,17 @@ import { definePageMetadata } from '@/scripts/page-metadata';
let ads: any[] = $ref([]); let ads: any[] = $ref([]);
// ISOTZUTCTZ
const localTime = new Date();
const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
os.api('admin/ad/list').then(adsResponse => { os.api('admin/ad/list').then(adsResponse => {
ads = adsResponse.map(r => { ads = adsResponse.map(r => {
const date = new Date(r.expiresAt);
date.setMilliseconds(date.getMilliseconds() - localTimeDiff);
return { return {
...r, ...r,
expiresAt: new Date(r.expiresAt).toISOString().slice(0, 16), expiresAt: date.toISOString().slice(0, 16),
}; };
}); });
}); });