I have a date time picker as a calendar. is there anyway that i avoid backdating in the calendar ? It should be only pick today and future dates.
Thank you all.
Not sure if there is a way to have a client side restriction on date range. Alternatively you can apply a validation rule
on the field to keep the data as you need.
If your field is of type Date
,
Your_Field < TODAY()
If your field is of type DateTime
,
DATEVALUE(Your_Field) < TODAY()
Also make sure to do the data cleanup for the existing data if you are applying such a validation. If not the reports will show unacceptable data to your managers ;)
DateTime
field and you are going to do a data migration for that, take care about the timezone difference. Because we should consider that Saleforce keeps DateTime
field values as GMT
and they will be converted into user's timezone when rendering on pages
There is no way to control the date picker in salesforce.I think you neeed to use jquery calendar to avoid backdating.
http://jsfiddle.net/antelopelovefan/ZW7cs/34/
$(document).ready(function() {
$('#Date').datepicker({
onSelect: function(dateText, inst) {
//Get today's date at midnight
var today = new Date();
today = Date.parse(today.getMonth()+1+'/'+today.getDate()+'/'+today.getFullYear());
//Get the selected date (also at midnight)
var selDate = Date.parse(dateText);
if(selDate < today) {
//If the selected date was before today, continue to show the datepicker
$('#Date').val('');
$(inst).datepicker('show');
}
}
});
});