added textvalidators

This commit is contained in:
2026-06-09 17:42:14 +02:00
parent 05b9d3e920
commit d44070a8e9
+14
View File
@@ -0,0 +1,14 @@
String? timeValidator(String? value) {
if (value == null || value.isEmpty) return null;
if (RegExp(r'^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$').hasMatch(value)) {
return null;
}
return 'Not a valid time format';
}
String? dateTimeValidator(String? value) {
if (value == null || value.isEmpty) return null;
return DateTime.tryParse(value) != null ? null : 'Not a date format';
}