format throws when used on "Invalid Date" with advancedformat + timezone + utc
See original GitHub issueDescribe the bug When using the following format string on dayjs(null) the resulting date is “Invalid Date”
lll
When using the following string, dayjs throws
lll z
Thrown error:
Unhandled Runtime Error
RangeError: date value is not finite in DateTimeFormat.formatToParts()
dayjs(null).format('lll z')
           ^
Expected behavior dayjs should display “Invalid Date” and not throw an error
Information
- Day.js Version v1.10.5
 - OS: Windows
 - Browser Firefox 89.0.2 (64-bit)
 - Time zone: EST
 
Issue Analytics
- State:
 - Created 2 years ago
 - Reactions:1
 - Comments:6 (4 by maintainers)
 
Top Results From Across the Web
Trying to format date, always getting invalid date
When the user submits the form, I want to transform the date input to UTC using moment. However whatever I do with the...
Read more >format throws when used on "Invalid Date" with ... - Issuehunt
format throws when used on "Invalid Date" with advancedformat + timezone + utc #1558 ; Describe the bug When using the following format...
Read more >RangeError: invalid date - JavaScript - MDN Web Docs
The JavaScript exception "invalid date" occurs when a string leading to an invalid date has been provided to Date or Date.parse().
Read more >Behavior and format of the Date and Time column
In Microsoft Dataverse, the Date and Time data type is used in many ... column values remain in the database in the UTC...
Read more >Validation
Checks if the value could be parsed to a Date time and it is a valid date. The last two arguments format and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

My bad, I should have mentionned that the
zformat option is only enabled withadvancedFormat. Here’s a working example of the issue:index.js
Merged complete