Ruby throws Date::Error on a valid date (DateTime.parse)

Viewed 30

I'm using Ruby's date module to convert/parse my date into a DateTime object. To do this, I'm using DateTime.parse(<time>). But it throws Date::Error even though it's a valid date. Full error message:

2022-07-13 09:54:48 - Date::Error - invalid date:
        main.rb:123:in `parse'
        main.rb:123:in `block (2 levels) in <main>'
        main.rb:121:in `each'
        main.rb:121:in `block in <main>'

Code that throws the error:

time = DateTime.parse(client["properties"]["closedate"])
0 Answers
Related