Skip to content

Conversation

@WRMSRwasTaken
Copy link

Using the CustomParseFormat plugin together with the UTC plugin seems possible:

const dayjs = require('dayjs');
const utc = require('dayjs/plugin/utc');
const customParseFormat = require('dayjs/plugin/customParseFormat');
dayjs.extend(customParseFormat);
dayjs.extend(utc);
dayjs.utc('2025-4-05', ['YYYY-M-D', 'YYYY-MM-D', 'YYYY-M-DD', 'YYYY-MM-DD'], true).day();
// 5
dayjs.utc('2025-04-5', ['YYYY-M-D', 'YYYY-MM-D', 'YYYY-M-DD', 'YYYY-MM-DD'], true).day();
// 5

But the types don't line up, giving me an error in my TS project:
webstorm64_qWojpP1hqZ

Seems to be an easy fix by just orienting on what's already defined as function parameters in index.d.ts.

@iamkun
Copy link
Owner

iamkun commented Aug 28, 2025

Thanks

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

Successfully merging this pull request may close these issues.

2 participants