timecop icon indicating copy to clipboard operation
timecop copied to clipboard

parse_with_mock_date should be able to handle incorrect input data with clear error

Open pvmeerbe opened this issue 8 years ago • 1 comments

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

pvmeerbe avatar Aug 25 '16 08:08 pvmeerbe

Just came here for the very same reason 👍

RKushnir avatar Sep 02 '16 12:09 RKushnir