Sharkey/src/client/app/common/scripts/date-stringify.ts

14 lines
464 B
TypeScript
Raw Normal View History

2017-03-18 20:05:11 +09:00
export default date => {
2017-02-18 10:52:51 +09:00
if (typeof date == 'string') date = new Date(date);
return (
2018-08-02 19:03:31 +09:00
date.getFullYear() + '%i18n:common.date.full-year%' +
(date.getMonth() + 1) + '%i18n:common.date.month%' +
date.getDate() + '%i18n:common.date.day%' +
2017-02-18 10:52:51 +09:00
' ' +
2018-08-02 19:03:31 +09:00
date.getHours() + '%i18n:common.date.hours%' +
date.getMinutes() + '%i18n:common.date.minutes%' +
2017-02-18 10:52:51 +09:00
' ' +
`(${['日', '月', '火', '水', '木', '金', '土'][date.getDay()]})`
);
};