Closed neilwongtinpo closed 1 month ago
In the test case, months are from 1 to 12 https://github.com/Leo4815162342/dukascopy-node/blob/1ce9a7e7c37f1ccfa1eb2ddc071d04c63350907c/src/utils/date.test.ts
But in below script: https://github.com/Leo4815162342/dukascopy-node/blob/1ce9a7e7c37f1ccfa1eb2ddc071d04c63350907c/src/utils/date.ts#L63
line 63: const utcDate = new Date(Date.UTC(year, month, day || 1, hour));
should be changed to const utcDate = new Date(Date.UTC(year, month-1, day || 1, hour));
because the month in Date constructor are of range from 0 to 11
my bad, seems the server url used 0..11 for month too
In the test case, months are from 1 to 12 https://github.com/Leo4815162342/dukascopy-node/blob/1ce9a7e7c37f1ccfa1eb2ddc071d04c63350907c/src/utils/date.test.ts
But in below script: https://github.com/Leo4815162342/dukascopy-node/blob/1ce9a7e7c37f1ccfa1eb2ddc071d04c63350907c/src/utils/date.ts#L63
line 63: const utcDate = new Date(Date.UTC(year, month, day || 1, hour));
should be changed to const utcDate = new Date(Date.UTC(year, month-1, day || 1, hour));
because the month in Date constructor are of range from 0 to 11