ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

incorrect time output #176

Closed zchung closed 7 years ago

zchung commented 7 years ago

I have been getting incorrect time outputs when using the date-format option with moment js in the time-only date-picker element.

If I set the date format to "HH:mm" it seems to gives me the incorrect time but when I use "DD/MM/YYYY hh:mm" it is correct.

correcteventtime incorrecttime htmlcode

I have tried other combinations such as "h:mm a" but it always seems to give me the incorrect time. At first I thought it was a timezone issue but my javascript object doesn't have a TZ in it and if that were the case then it would be different times in the output, not the same ones.

zchung commented 7 years ago

Never mind. Should have looked deeper at the source code before posting. The fix is using parse-format="YYYY-MM-DD HH:mm:ss"