JSFiddle - React, Tailwind, and code Playground

by yshrkn

JavaScript

class DateEx extends Date {
    getDayJp(full = false) {
        const daysJp = ['日', '月', '火', '水', '木', '金', '土'];
        return daysJp[this.getDay()] + (full ? '曜日' : '');
    }
}
const date = new DateEx(2018, 0, 1);
console.log(date.getDayJp());  // 月