Closed epa closed 1 year ago
In the documentation for Date::Manip::TZ, it states:
$date A date is always a string containing a date in one of the formats:
YYYYMMDDHH:MN:SS
YYYY-MM-DD-HH:MN:SS
YYYYMMDDHHMNSS
or a list reference:
[Y,M,D,H,MN,S]
Since you did not supply the date in one of the allowed formats, an error is expected. Since the Date::Manip::TZ module isn't about parsing dates (that's what Date::Manip::Date is for), it only supports a couple formats (which are used internally for all of the Date::Manip modules).
As for the error message... you didn't look at the return values. The convert function returns a 4 (it actually didn't before... you did find a bug). The documentation says that that means an invalid date. So check the return code ($err in your example) before you try to use $ref.
The bug will be fixed in the next release. Thanks
If you change the space character between date and time to
-
then it works.The error message should be better: "date and time string not in recognized format".
Also, since you already accept a handful of different formats, I think the regexps used could be a bit more tolerant and allow examples like the above.