dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Fix for UTC plugin type definitions in combination with CustomParseFormat plugin

Open WRMSRwasTaken opened this issue 8 months ago • 1 comments

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.

WRMSRwasTaken avatar Jun 08 '25 13:06 WRMSRwasTaken

Thanks

iamkun avatar Aug 28 '25 09:08 iamkun