fix: 広告のexpiresAtをLocalTZ分ずらして初期化 (#9876)
* fix: 広告のexpiresAtをLocalTZ分ずらして初期化 * chore: 不要なインポートを削除
This commit is contained in:
parent
f28aea9e30
commit
ac7e2ecb59
1 changed files with 7 additions and 1 deletions
|
@ -60,11 +60,17 @@ import { definePageMetadata } from '@/scripts/page-metadata';
|
|||
|
||||
let ads: any[] = $ref([]);
|
||||
|
||||
// ISO形式はTZがUTCになってしまうので、TZ分ずらして時間を初期化
|
||||
const localTime = new Date();
|
||||
const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
|
||||
|
||||
os.api('admin/ad/list').then(adsResponse => {
|
||||
ads = adsResponse.map(r => {
|
||||
const date = new Date(r.expiresAt);
|
||||
date.setMilliseconds(date.getMilliseconds() - localTimeDiff);
|
||||
return {
|
||||
...r,
|
||||
expiresAt: new Date(r.expiresAt).toISOString().slice(0, 16),
|
||||
expiresAt: date.toISOString().slice(0, 16),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue