knowledgecode/date-and-time

Sudden invalid date

Closed this issue · 4 comments

Hey! We had a flawlessly working system and our "working" code suddenly starts giving us Invalid Date outputs
I have tried code from months back and give the same error

    const date = interaction.options.getString("event-date");
    console.log(date);
    const pattern = datetime.compile("D-M-YYYY h:m A");
    let parsedDate = datetime.parseTZ(date, pattern, "Asia/Kolkata");
13-2-2023 9:45 PM
Invalid Date

System Info

NODE - v18.13.0
Linux localhost.localdomain 5.15.85-gentoo-dist #1 SMP Thu Dec 22 12:11:58 -00 2022 x86_64 AMD A8-7410 APU with AMD Radeon R5 Graphics AuthenticAMD GNU/Linux

Thank you for your report.
After investigating the cause, we found that this issue occurs in Node.js v18.13.0 and above. If possible, you can work around it by lowering your Node.js version to v18.12.1.

Anyway, this is not a bug in this library, but we will release a fixed version to work around it.

Copy, appreciate the ultra fast response.

We have released a new version v2.4.2. This version of the timezone plugin should probably work with Node.js v18.13.0 and above, but please check just in case.

2.4.2 seems to have fixed this issue.