We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug A clear and concise description of what the bug is.
I'm trying to convert a date to a readable format.
For example:
var dayjs = require('dayjs') const date = '1989-08-12T01:00:00.000Z' console.log(dayjs(date).format('DD/MM/YYYY'))
The result shows: 11/08/1989
Expected behavior A clear and concise description of what you expected to happen.
I expect that the log should return 12/08/1989 instead of 11/08/1989
Not sure if I miss any parameters or not. Thanks,
Information
The text was updated successfully, but these errors were encountered:
Dayjs will parse date to local time by default.
If you want to get time in utc, please use dayjs.utc
dayjs.utc
var dayjs = require("dayjs") var utc = require("dayjs/plugin/utc") dayjs.extend(utc) const date = '1989-08-12T01:00:00.000Z' console.log(dayjs(date).format()) // "1989-08-12T10:00:00+09:00" const date2 = '1989-08-12T01:00:00.000Z' console.log(dayjs.utc(date2).format()) "1989-08-12T01:00:00Z"
Sorry, something went wrong.
Thanks @iamkun. And this is for TypeScript usage
import * as dayjs from 'dayjs' import * as utc from 'dayjs/plugin/utc' dayjs.extend(utc)
No branches or pull requests
Describe the bug
A clear and concise description of what the bug is.
I'm trying to convert a date to a readable format.
For example:
The result shows: 11/08/1989
Expected behavior
A clear and concise description of what you expected to happen.
I expect that the log should return 12/08/1989 instead of 11/08/1989
Not sure if I miss any parameters or not. Thanks,
Information
The text was updated successfully, but these errors were encountered: