1
0
forked from mirror/misskey

日付のフォーマット指定と変更がうまくいかない

This commit is contained in:
nenohi 2023-02-17 12:22:27 +09:00
parent cd5615d354
commit c8a81364ef

View File

@ -1,9 +1,12 @@
<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
<template #header>
<XHeader :actions="headerActions" :tabs="headerTabs" />
</template>
<MkSpacer :content-max="900">
<div class="uqshojas">
<div v-for="ad in ads" class="_panel _gaps_m ad">
<MkPagination v-slot="{ items }" :pagination="pagination" :on-vnode-updated="update()">
<div v-for="ad in items" class="_panel _gaps_m ad">
<MkAd v-if="ad.url" :specify="ad" />
<MkInput v-model="ad.url" type="url">
<template #label>URL</template>
@ -40,10 +43,13 @@
<template #label>{{ i18n.ts.memo }}</template>
</MkTextarea>
<div class="buttons">
<MkButton class="button" inline primary style="margin-right: 12px;" @click="save(ad)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
<MkButton class="button" inline danger @click="remove(ad)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }}</MkButton>
<MkButton class="button" inline primary style="margin-right: 12px;" @click="save(ad)"><i
class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
<MkButton class="button" inline danger @click="remove(ad)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }}
</MkButton>
</div>
</div>
</MkPagination>
</div>
</MkSpacer>
</MkStickyContainer>
@ -56,6 +62,7 @@ import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import MkRadios from '@/components/MkRadios.vue';
import MkPagination from '@/components/MkPagination.vue';
import FormSplit from '@/components/form/split.vue';
import * as os from '@/os';
import { i18n } from '@/i18n';
@ -67,19 +74,24 @@ let ads: any[] = $ref([]);
const localTime = new Date();
const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
os.api('admin/ad/list').then(adsResponse => {
ads = adsResponse.map(r => {
const exdate = new Date(r.expiresAt);
const stdate = new Date(r.startsAt);
exdate.setMilliseconds(exdate.getMilliseconds() - localTimeDiff);
stdate.setMilliseconds(stdate.getMilliseconds() - localTimeDiff);
return {
...r,
expiresAt: exdate.toISOString().slice(0, 16),
startsAt: stdate.toISOString().slice(0, 16),
// os.api('admin/ad/list').then(adsResponse => {
// ads = adsResponse.map(r => {
// const exdate = new Date(r.expiresAt);
// const stdate = new Date(r.startsAt);
// exdate.setMilliseconds(exdate.getMilliseconds() - localTimeDiff);
// stdate.setMilliseconds(stdate.getMilliseconds() - localTimeDiff);
// return {
// ...r,
// expiresAt: exdate.toISOString().slice(0, 16),
// startsAt: stdate.toISOString().slice(0, 16),
// };
// });
// });
const pagination = {
endpoint: 'admin/ad/list' as const,
limit: 10,
};
});
});
function add() {
ads.unshift({
@ -148,5 +160,4 @@ definePageMetadata({
margin-bottom: var(--margin);
}
}
}
</style>
}</style>