fix: date formatting in previous note view

This commit is contained in:
Mar0xy 2023-10-22 13:36:34 +02:00
parent d50e81e475
commit 2706b6b618
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
3 changed files with 9 additions and 3 deletions

View file

@ -3,6 +3,7 @@ import * as Misskey from 'misskey-js';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { MenuItem } from '@/types/menu.js';
import { dateTimeFormat } from './intl-const.js';
export async function getNoteVersionsMenu(props: {
note: Misskey.entities.Note;
@ -35,9 +36,13 @@ export async function getNoteVersionsMenu(props: {
await statePromise.then((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({
icon: 'ph-pencil ph-bold ph-lg',
text: `${edit.updatedAt}`,
text: dateTimeFormat.format(_time),
action: () => openVersion(edit),
});
}