adzap / timeliness

Fast date/time parsing for the control freak.
http://github.com/adzap/timeliness
MIT License
224 stars 27 forks source link

Gracefully Handle Date Format Removal #35

Open ahcarpenter opened 5 years ago

ahcarpenter commented 5 years ago

Hey, @adzap, thanks a ton for this gem.

Ran across a case where my team had added a gem that had an initializer calling remove_formats with the same args as the app the gem had been bundled with.

This led to us not being able to boot up rails as currently, the gem raises a hard exception if it's not able to delete a date format.

What do you think about us keeping delete's default behavior (returning nil) to avoid this?

Would be happy to update the gem if you were in favor as well.

adzap commented 5 years ago

Yes that does seem too aggressive. I have also been reviewing the add add_formats throwing an error when format exists also. But remove_formats seems like an easier decision since it has little impact if the format is not there, perhaps just output to stderr.