You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm considering making a fork of Carbon to add support for Carbon::parse() to throw an AmbiguousDateException (or something similarly-named) so that it could always be used without fear of misinterpreting dates.
For example, "20-02-2015" is not ambiguous and would be accepted, whereas "10-02-2015" is and would throw an exception, which could then be caught by the application to let the user know that their inputted date could mean multiple dates, and that they should enter it in a different format. Of course, enforcing a specific date format is best (and is what I currently do), but there are situations where it places an unnecessary burden on the user (e.g. importing data where you don't know the date format). In that situation, if most of the dates could be figured out automatically and you only had to ask the user to check a couple of them because they're ambiguous, that would beat forcing users to use a specific format, in my opinion.
I don't know if anyone would find this useful, but I know I would. If I built it and created a thorough suite of unit tests for it, would it be something you think is worth adding to Carbon?
The text was updated successfully, but these errors were encountered:
I'm considering making a fork of Carbon to add support for
Carbon::parse()
to throw an AmbiguousDateException (or something similarly-named) so that it could always be used without fear of misinterpreting dates.For example, "20-02-2015" is not ambiguous and would be accepted, whereas "10-02-2015" is and would throw an exception, which could then be caught by the application to let the user know that their inputted date could mean multiple dates, and that they should enter it in a different format. Of course, enforcing a specific date format is best (and is what I currently do), but there are situations where it places an unnecessary burden on the user (e.g. importing data where you don't know the date format). In that situation, if most of the dates could be figured out automatically and you only had to ask the user to check a couple of them because they're ambiguous, that would beat forcing users to use a specific format, in my opinion.
I don't know if anyone would find this useful, but I know I would. If I built it and created a thorough suite of unit tests for it, would it be something you think is worth adding to Carbon?
The text was updated successfully, but these errors were encountered: