Posted on: 12/31/2013 12:27:10 PM | Views : 614

I am trying to prevent users entering the wrong date.I have found Momemnt.js for handling dates and it works on the (http://jsfiddle.net/vinodgubbala/6MEG6/).

<script type="text/javascript" src='http://momentjs.com/downloads/moment-with-langs.min.js'> $(document).ready(function() { function CheckForPastDate(sender, args) { selectedDate = sender._selectedDate; var todayDate = new Date(); if (selectedDate.getTime() < todayDate.getTime()) { sender.selectedDate = todayDate; sender._textbox.value = moment(selectedDate).format(sender._format); alert("Wrong date!"); } } CheckForPastDate({ _textbox: document.getElementById('<%#TextBox1.ClientID %>'), _selectedDate: new Date(2013, 5, 3), _format: 'MMMM Do YYYY, h:mm:ss a' }); }); ...

Go to the complete details ...