import moment from 'moment-timezone'; > var guessTimeZone = moment.tz.guess() undefined > guessTimeZone 'Europe/London'
> moment.tz('2016-05-23 09:57:00', guessTimeZone).format('YYYY-MM-DD HH:mm:ss') '2016-05-23 09:57:00' <- this is my data format with month proceeded by 0, but incorrect time output > moment.tz('2016-5-23 09:57:00', guessTimeZone).format('YYYY-MM-DD HH:mm:ss') '2016-05-23 10:57:00' <- This is what I expect as correct time, but only after having to adjust to another month input format
> moment.tz('2016-12-20 09:57:00', guessTimeZone).format('YYYY-MM-DD HH:mm:ss') '2016-12-20 09:57:00' <- Now correct
So my question is how come I needed to remove the leading zero in front of the month data format to get the right answer as I cannot modify external data from provider, unless I parse it within my app (which is something I prefer to avoid, but may have to parse using regex etc to remove leading zeros)?
Or is this a bug within the library?