File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/digit_forms_engine/lib/utils Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,15 @@ bool isHidden(PropertySchema property) {
152152
153153/// Checks if the string can be parsed as a DateTime
154154bool isDateTime (String input) {
155- return DateTime .tryParse (input) != null ;
155+
156+ if (RegExp (r'^\d{4}-\d{2}-\d{2}' ).hasMatch (input)) {
157+ return DateTime .tryParse (input) != null ;// ISO 8601
158+ } else if (RegExp (r'^\d{2}/\d{2}/\d{4}$' ).hasMatch (input)) {
159+ return DateTime .tryParse (input) != null ;
160+ }
161+
162+ return false ;
163+
156164}
157165
158166bool isDateLike (String input) {
@@ -173,7 +181,7 @@ DateTime parseDate(String input) {
173181 final year = int .parse (parts[2 ]);
174182 return DateTime (year, month, day);
175183 }
176- throw FormatException ('Unsupported date format' );
184+ throw const FormatException ('Unsupported date format' );
177185}
178186
179187bool isDotSeparatedKey (String input) {
You can’t perform that action at this time.
0 commit comments