(js) Handle non-latin characters in date validator

This commit is contained in:
Francis Lachapelle committed 2019-02-26 09:58:09 -05:00
1 parent e993de4f8f
commit 108f4c7eb8
2 files changed
+13

No files matched your search

@@ -154,6 +154,13 @@
_this.$mdDateLocaleProvider.formatTime = function(date) {
return date? date.format(_this.$mdDateLocaleProvider, _this.defaults.SOGoTimeFormat) : '';
};
_this.$mdDateLocaleProvider.isDateComplete = function(dateString) {
dateString = dateString.trim();
// The default function of Angular Material doesn't handle non-latin characters.
// This one does.
var re = /^((([a-zA-Z]|[^\x00-\x7F]){3,}|[0-9]{1,4})([ .,]+|[/-])){2}(([a-zA-Z]|[^\x00-\x7F]){3,}|[0-9]{1,4})$/;
return re.test(dateString);
};
}
settingsElement = Preferences.$document[0].getElementById('UserSettings');