Skip to content

Firefly III: a personal finances manager

Catch error.

James Cole89f98bb7ab1f
diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php
index 23af02ac1d..44f47a032f 100644
--- a/app/Rules/IsDateOrTime.php
+++ b/app/Rules/IsDateOrTime.php
@@ -26,6 +26,7 @@ namespace FireflyIII\Rules;
use Carbon\Carbon;
use Carbon\Exceptions\InvalidDateException;
+use Carbon\Exceptions\InvalidFormatException;
use Illuminate\Contracts\Validation\Rule;
use Log;
@@ -67,6 +68,10 @@ class IsDateOrTime implements Rule
} catch (InvalidDateException $e) {
Log::error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage()));
+ return false;
+ } catch(InvalidFormatException $e) {
+ Log::error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
+
return false;
}
@@ -78,6 +83,10 @@ class IsDateOrTime implements Rule
} catch (InvalidDateException $e) {
Log::error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage()));
+ return false;
+ } catch(InvalidFormatException $e) {
+ Log::error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
+
return false;
}