timecop
timecop copied to clipboard
parse_with_mock_date should be able to handle incorrect input data with clear error
Currently the parse_with_mock_date routines expect the input to respond to .downcase.
However this is not always the case : imagine Form input validation with incorrect input data (for example with dry-validation and/or dry-types. In this case an integer value 5 could be received and an unclear error "undefined method `downcase' for 5:Fixnum" will be spawned.
Suggestion to check whether .downcase is supported for input data. This will cause the original parse function to detect the incorrect input data type and raise accordingly
Just came here for the very same reason 👍