pkg
pkg copied to clipboard
date.toLocaleDateString() returns date without zeros even if locale is provided
What version of pkg are you using?
5.8.0
What version of Node.js are you using?
v18.7.0
What operating system are you using?
Windows 10
What CPU architecture are you using?
x86_64
What Node versions, OSs and CPU architectures are you building for?
fetched-v18.5.0-win-x64
Describe the Bug
When you create new Date() and getting locale date string with or without specified locale, it returns date without zeros in days and months in exe.
const now = new Date();
console.log(now.toLocaleDateString(), now.toLocaleDateString('en-GB')); // 9/9/2022 9/9/2022
As you can see its the same. But, as script, the same, it returns with zeros in both cases:
const now = new Date();
console.log(now.toLocaleDateString(), now.toLocaleDateString('en-GB')); // 09/09/2022 09/09/2022

Expected Behavior
Should return date with zeros in days and months, as it is in script.
To Reproduce
const now = new Date();
console.log(now.toLocaleDateString(), now.toLocaleDateString('en-GB'));
Run it youself and then build it and exec it and see the difference.