webroo / dummy-json

Generates random dummy JSON data in Node.js
MIT License
380 stars 61 forks source link

Date generator generates some invalid dates. #37

Closed Saeron closed 3 years ago

Saeron commented 4 years ago

Hello,

This is from my template:

"visitStart": "{{date "2020-01-01T09:00:00.000" "2020-12-30T19:00:00.000" "YYYY-MM-dd HH:mm:ss.SSS"}}",

and some times i get thinsg like:

"visitStart": "2020-04-00 01:26:30.277"

and of course there is no day 00 so I get invalid date.

Is this a issue or I am doing anything wrong?.

Regards.

webroo commented 3 years ago

This looks like a simple mistake in your formatting string. You're using dd which is day of the week (a number from 0 to 6), I assume you probably want DD which is the day of the month.

You can refer to the fecha README for more formatting options: https://github.com/taylorhakes/fecha#formatting-tokens