Skip to content
New issue

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

dayjs在vue2代码中 任意地方执行 格式转换都返回false 代码如下 #2777

Open
shaoshaui opened this issue Nov 28, 2024 · 1 comment

Comments

@shaoshaui
Copy link

const time1 = '05:00' // 符合 'HH:mm' 格式
const parsedTime = dayjs(time1, 'HH:mm')
console.log(parsedTime.isValid()) // true

放在官网执行返回true
放在vue2 mounted里边执行 返回false

@Beats0
Copy link

Beats0 commented Dec 24, 2024

没加 extend customParseFormat

const dayjs = require('dayjs')
const customParseFormat = require("dayjs/plugin/customParseFormat");

dayjs.extend(customParseFormat);

const time1 = '05:00'
const parsedTime = dayjs(time1, 'HH:mm')
console.log(parsedTime.isValid()) // true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants