You dont need Momentjs
Problem
The format I need: 2020-04-20T16:20:00+09:00
Some code smell I wrote :-ss
const standardizeDate = (date) => {
date.setHours(date.getHours() + 9);
return date.toISOString().slice(0, -5) + "+09:00";
}
This one looks much better:
<script src="https://unpkg.com/dayjs@1.8.21/dayjs.min.js"></script>
const standardizeDate = (date) => dayjs(date).format('YYYY-MM-DDTHH:mm:ssZ');
Performance concerns
Shout out to You-Dont-Need-Momentjs and also dayjs