Closed abicky closed 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.
Strptime.new('%Y-%m-%d %H:%M:%S')
Time.strptime('2020-05-11 01:23:45+09:00', '%Y-%m-%d %H:%M:%S')
strptime sometimes just parse the prefix of string like logfile. For example it parses below line. Therefore ignoring extra characters is intended.
strptime
2020-05-11 01:23:45 [ERROR] invalid argument
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.