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

V1.11.12 >>> ISO 8601 "YYYY-MM-DDTHH:mm:ssZ" BUG! #2712

Open
gowy222 opened this issue Aug 19, 2024 · 1 comment
Open

V1.11.12 >>> ISO 8601 "YYYY-MM-DDTHH:mm:ssZ" BUG! #2712

gowy222 opened this issue Aug 19, 2024 · 1 comment

Comments

@gowy222
Copy link

gowy222 commented Aug 19, 2024

dayjs: v1.11.12
nodejs: v18.18.2
win11

"use strict";
const dayjs = require("dayjs");
const dayjs_timezone = require('dayjs/plugin/timezone');
const dayjs_utc = require('dayjs/plugin/utc');
const duration = require('dayjs/plugin/duration');
const customParseFormat = require('dayjs/plugin/customParseFormat');

dayjs.extend(duration);
dayjs.extend(dayjs_utc);
dayjs.extend(dayjs_timezone);
dayjs.extend(customParseFormat);
dayjs.tz.setDefault("Asia/Shanghai");


console.log(dayjs('2024-08-19T10:30:00Z', "YYYY-MM-DDTHH:mm:ssZ", true).isValid()); => false
M {
  '$L': 'en',
  '$u': undefined,
  '$d': Invalid Date,
  '$y': 2024,
  '$M': 7,
  '$D': 19,
  '$W': 1,
  '$H': 18,
  '$m': 30,
  '$s': 0,
  '$ms': 0,
  '$x': {},
  '$isDayjsObject': true
}




console.log(dayjs.utc('2024-08-19T10:30:00Z', "YYYY-MM-DDTHH:mm:ssZ", true).isValid()); => dayjs.utc still false!
M {
  '$L': 'en',
  '$u': true,
  '$d': Invalid Date,
  '$y': 2024,
  '$M': 7,
  '$D': 19,
  '$W': 1,
  '$H': 10,
  '$m': 30,
  '$s': 0,
  '$ms': 0,
  '$x': {},
  '$isDayjsObject': true
}

exinfo:
2024: Matches YYYY, representing the year.
08: Matches MM, representing the month of August.
19: Matches DD, representing the 19th day of the month.
T: The literal 'T' is correctly placed as the separator between the date and time.
10: Matches HH, representing the hour in 24-hour format.
30: Matches mm, representing the minutes past the hour.
00: Matches ss, representing the seconds.
Z: Indicates that the time is in UTC.

@skmainzmn
Copy link

I have the same problem when trying to parse from format DD.MM.YYYY HH:mm

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