morilog / jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in php appliations, based on Jalali (Shamsi) DateTime class.
MIT License
856 stars 111 forks source link

Jalalian::fromFormat() throws exception in case of invalid input #87

Closed hshahdoost closed 3 years ago

hshahdoost commented 4 years ago

What I'm about to say is more of a feature, As I'm using this library, I have noticed that there is no way to check the validation of our string date before using fromFormat method. And this method directly throws an ErrorException (which is pretty general) in case there is anything wrong with the user input, I believe it would be a lot better if there was a method which could simply validate a given string date with a format, to avoid general exception handling.

PS: Thanks a lot for taking time and putting effort into this library.

hsyir commented 4 years ago

@hshahdoost good idea, i have this challenge with this as you have.