Relative Content

Tag Archive for dayjs

dayjs.toString() prints wrong time

import dayjs from “dayjs”; console.log(dayjs().startOf(‘day’).format()) // 2024-06-21T00:00:00+08:00 console.log(dayjs().startOf(‘day’).toString()) // Thu, 20 Jun 2024 16:00:00 GMT The time in format() is correct. The time printed by toString() is totally wrong. why? dayjs 0 Actually, they are the same time. The toString() function of dayjs converts date to Greenwich Mean Time. Your first datetime is on GMT/UTC […]

dayjs.toSring() prints wrong time

import dayjs from “dayjs”; console.log(dayjs().startOf(‘day’).format()) // 2024-06-21T00:00:00+08:00 console.log(dayjs().startOf(‘day’).toString()) // Thu, 20 Jun 2024 16:00:00 GMT The time in format() is correct. The time printed by toString() is totally wrong. why? dayjs