mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 00:43:08 +02:00
fix: date formatting in previous note view
This commit is contained in:
parent
d50e81e475
commit
2706b6b618
3 changed files with 9 additions and 3 deletions
|
@ -50,7 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
for (const edit of edits) {
|
for (const edit of edits) {
|
||||||
editArray.push({
|
editArray.push({
|
||||||
updatedAt: new Date(edit.updatedAt).toLocaleString('UTC', { hour: 'numeric', minute: 'numeric', second: 'numeric', year: 'numeric', month: 'short', day: 'numeric' }),
|
updatedAt: edit.updatedAt,
|
||||||
text: edit.oldText,
|
text: edit.oldText,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<MkWindow ref="window" :initialWidth="500" :initialHeight="300" :canResize="true" @closed="emit('closed')">
|
<MkWindow ref="window" :initialWidth="500" :initialHeight="300" :canResize="true" @closed="emit('closed')">
|
||||||
<template #header>
|
<template #header>
|
||||||
<i class="ph-warning-circle ph-bold ph-lg" style="margin-right: 0.5em;"></i>
|
<i class="ph-warning-circle ph-bold ph-lg" style="margin-right: 0.5em;"></i>
|
||||||
<b>Previous Version from {{ appearNote.createdAt }}</b>
|
<b>Previous Version from {{ dateTimeFormat.format(new Date(appearNote.createdAt)) }}</b>
|
||||||
</template>
|
</template>
|
||||||
<div ref="el" :class="$style.root">
|
<div ref="el" :class="$style.root">
|
||||||
<article :class="$style.note">
|
<article :class="$style.note">
|
||||||
|
@ -92,6 +92,7 @@ import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
||||||
import { $i } from '@/account.js';
|
import { $i } from '@/account.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { deepClone } from '@/scripts/clone.js';
|
import { deepClone } from '@/scripts/clone.js';
|
||||||
|
import { dateTimeFormat } from '@/scripts/intl-const.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
|
|
@ -3,6 +3,7 @@ import * as Misskey from 'misskey-js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { MenuItem } from '@/types/menu.js';
|
import { MenuItem } from '@/types/menu.js';
|
||||||
|
import { dateTimeFormat } from './intl-const.js';
|
||||||
|
|
||||||
export async function getNoteVersionsMenu(props: {
|
export async function getNoteVersionsMenu(props: {
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -35,9 +36,13 @@ export async function getNoteVersionsMenu(props: {
|
||||||
|
|
||||||
await statePromise.then((versions) => {
|
await statePromise.then((versions) => {
|
||||||
for (const edit of versions) {
|
for (const edit of versions) {
|
||||||
|
const _time = edit.updatedAt == null ? NaN :
|
||||||
|
typeof edit.updatedAt === 'number' ? edit.updatedAt :
|
||||||
|
(edit.updatedAt instanceof Date ? edit.updatedAt : new Date(edit.updatedAt)).getTime();
|
||||||
|
|
||||||
menu.push({
|
menu.push({
|
||||||
icon: 'ph-pencil ph-bold ph-lg',
|
icon: 'ph-pencil ph-bold ph-lg',
|
||||||
text: `${edit.updatedAt}`,
|
text: dateTimeFormat.format(_time),
|
||||||
action: () => openVersion(edit),
|
action: () => openVersion(edit),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue