Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a use case wherein I have many EFFECTIVE FROM AND EFFECTIVE TO dates to be validated. I am planning to achieve this through a directive. Could any help me achieve this using modifying the following code
If effective To cannot be greater effective from (i.e graying out )
Similarly for effective From cannot be less than

What I have tried:

app.directive('jqdatepicker', function() {
	return {
		restrict : 'A',
		require : 'ngModel',
		link : function(scope, element, attrs, ngModelCtrl) {
			$(function() {
				element.datepicker({
					dateFormat : 'dd-M-yy',
					maxDate : "Now",
					changeYear : true,
					yearRange : "-100:+100",
				

					showButtonPanel : true,
					closeText : 'Clear',
					onClose : function(date, inst) {
						if ($(window.event.srcElement).hasClass(
								'ui-datepicker-close')) {
							document.getElementById(this.id).value = '';
						}

					},

					onSelect : function(date) {
						scope.$apply(function() {
							ngModelCtrl.$setViewValue(date);
						});
					}
				});
			});
		}
	}
});
Posted
Updated 31-Jan-17 0:59am

1 solution

See if this help's you Date validation [^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900