nurse / strptime

a fast strptime engine
Other
38 stars 12 forks source link

Raise an error if there are extra characters #17

Closed abicky closed 4 years ago

abicky commented 4 years ago

I believe most developers don't expect Strptime.new('%Y-%m-%d %H:%M:%S') to parse a string with a timezone, so it should raise an error. Time.strptime('2020-05-11 01:23:45+09:00', '%Y-%m-%d %H:%M:%S') returns "2020-05-11 01:23:45 +0000", though.

nurse commented 4 years ago

strptime sometimes just parse the prefix of string like logfile. For example it parses below line. Therefore ignoring extra characters is intended.

2020-05-11 01:23:45 [ERROR] invalid argument