I need to validate date in localized format (SK) and it is not possible with knockout validation.
I am using: Durandal 1.2.0 Knockout 2.3.0 Knockout validation https://g
The only working solution I have for now is below.
The problem with this validator is that it also validates default(EN) date format as valid, so I have to add a IF to return this as invalid date format.
var dateValidator = function (val) {
if (!val)
return false;
if (moment(val, 'DD.MM.YYYY HH:mm').isValid()) {
return true;
}
else
return false;
};
var startDate = ko.observable().extend({ validation: { validator: dateValidator, message: 'Start of task is not in correct format.' } });