Sha256: ccf63bb5d28654da6741ec5a976bcb0446f198a2d98a5a4ce7b8ed26bc9666bd
Contents?: true
Size: 837 Bytes
Versions: 11
Compression:
Stored size: 837 Bytes
Contents
(function(ko, $, moment) { "use strict"; ko.extenders.validDate = function(target, options) { ko.utils.validatorBase(target); var defaults = { message: "" }; options = $.extend({}, defaults, options); target.validate = function validate(newValue) { var validatableValue = typeof newValue === 'undefined' ? target() : newValue, m = moment(validatableValue, ["DD MM", "DD MM YY", "DD MM YYYY"]); if ( m === null || !m.isValid() || m.isBefore(moment().startOf('day')) ) { target.markInvalid(options.message); return false; } target.markValid(); return true; }; target.subscribe(target.validate); //return the original observable return target; }; })(ko, $, moment);
Version data entries
11 entries across 11 versions & 1 rubygems