From: "CaryInVictoria (Cary Swoveland)" Date: 2022-02-02T02:06:17+00:00 Subject: [ruby-core:107426] [Ruby master Bug#18565] strptime reports invalid date when string is "130AM" and format string is '%I:%M%p' Issue #18565 has been reported by CaryInVictoria (Cary Swoveland). ---------------------------------------- Bug #18565: strptime reports invalid date when string is "130AM" and format string is '%I:%M%p' https://bugs.ruby-lang.org/issues/18565 * Author: CaryInVictoria (Cary Swoveland) * Status: Open * Priority: Normal * ruby -v: 2.7.1 * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- `DateTime.strptime("1:30PM", '%I:%M%p')` and `DateTime.strptime("1:30PM", '%l:%M%p')` both return `#` `DateTime.strptime("130PM", '%I%M%p')` and `DateTime.strptime("130PM", '%l%M%p')` both raise the exception `Date::Error: invalid date` I don't understand why an exception should be raised when the string is `"130PM"`. Is this a bug? -- https://bugs.ruby-lang.org/ Unsubscribe: