if (Sys.Mvc.ValidatorRegistry.validators) {
    Sys.Mvc.ValidatorRegistry.validators["workday"] = function (rule) {

        return function (value, context) {

            var chosenDate = new Date(value);
            var element = context.fieldContext.elements[0].parentElement.parentElement;
            // check if element is datepicker
            var obj = $(element)
            if (obj.data() && obj.data('tDatePicker')) {
                chosenDate = obj.data('tDatePicker').value();
                obj.data('tDatePicker').hidePopup();
            }

            var isWorkday = chosenDate.getDay() > 0 && chosenDate.getDay() < 6;
            if (isWorkday) {
                return isWorkday;
            }
            else {
                return rule.ErrorMessage;
            }
        }
    };
}