1
0
forked from mirror/misskey

enhance(backend): MFMのunixtimeをISO形式で連合するように

This commit is contained in:
syuilo 2023-11-17 15:44:36 +09:00
parent 5f5712a3ee
commit 4b3f9bd9a6

View File

@ -276,9 +276,18 @@ export class MfmService {
}, },
fn: (node) => { fn: (node) => {
const el = doc.createElement('i'); if (node.props.name === 'unixtime') {
appendChildren(node.children, el); const text = node.children[0]!.type === 'text' ? node.children[0].props.text : '';
return el; const date = new Date(parseInt(text, 10) * 1000);
const el = doc.createElement('time');
el.setAttribute('datetime', date.toISOString());
el.textContent = date.toISOString();
return el;
} else {
const el = doc.createElement('i');
appendChildren(node.children, el);
return el;
}
}, },
blockCode: (node) => { blockCode: (node) => {