felixge/node-dateformat

The new WW modifier does not work as advertised

redneb opened this issue · 2 comments

Here's what I did:

$ mkdir /tmp/dateformat-test && cd /tmp/dateformat-test
$ npm i dateformat

+ dateformat@4.5.0
added 1 package from 4 contributors and audited 1 package in 1.185s
found 0 vulnerabilities

$ node -e 'console.log(require("dateformat")(new Date("1876-01-12"), "WW"))'
22

I was expecting that the last command would print 02 (i.e. the ISO week number 2, padded to 2 digits), but I got 22 (i.e. the week number printed twice).

The tests for WW included in this repo seem to work fine. That's when I clone this repo. Maybe there is an issue with the package uploaded to npm?

@redneb Thanks so much for raising this issue and providing super clear replication steps! 😄

You were right that it was an issue with the package uploaded to npm.
The package was not build before being published and so an older version without the WW mask was uploaded.

This has been corrected now and fixed with version 4.5.1
I have tested again with your replication steps and looks gucci!