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
Very late for this, but just want to share my updates on @ChoptimusPrime's answer. Not hard-coding the format:
ko.validation.rules['dateAndFormat'] = {
validator: function (val, format) {
return ko.validation.utils.isEmptyVal(val) || moment(val, format).isValid();
},
message: 'Please provide a valid date.'
};
ko.validation.registerExtenders();