misskey/src/web/app/common/scripts/date-stringify.ts

14 lines
355 B
TypeScript
Raw Normal View History

2017-03-18 04:05:11 -07:00
export default date => {
2017-02-17 17:52:51 -08:00
if (typeof date == 'string') date = new Date(date);
return (
2017-03-18 04:05:11 -07:00
date.getFullYear() + '年' +
(date.getMonth() + 1) + '月' +
2017-02-21 23:32:46 -08:00
date.getDate() + '日' +
2017-02-17 17:52:51 -08:00
' ' +
2017-03-18 04:05:11 -07:00
date.getHours() + '時' +
date.getMinutes() + '分' +
2017-02-17 17:52:51 -08:00
' ' +
`(${['日', '月', '火', '水', '木', '金', '土'][date.getDay()]})`
);
};