Set minDate in spDatePicker (sp-date-picker) in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2019 12:11 PM
Hi Experts,
I'm looking on how to set a minDate in the spDatePicker (sp-date-dicker) OOB Date Picker in Service Portal. I'm looking to set current date as Min Date in the start date picker and based on that, I'm looking to set min date for End Date picker.
Looking for some solution if someone has tried this or was able to get this.
Thanks
Ashwath

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2019 10:46 PM
the below link may give you some details!!
-satheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2022 03:40 AM
Hi SatheeshKumar,
I can disable the past dates from dataPicker but I want to show the error when user try to enter value manually in the textbox of date, the entered date should not less than the current date.
Thank you in advance 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2021 08:03 AM
Check out my reply here https://community.servicenow.com/community?id=community_question&sys_id=5d104b21db98dbc01dcaf3231f961918
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 11:15 AM
I realize this is an old post, but I found myself with a similar requirement and looks like they've added additional options (snMaxDate and snMinDate) that would be helpful for setting minimum and maximum date values for the date picker.
HTML:
<sp-date-picker sn-max-date="max" sn-min-date="min" aria-label="To Date" field="toDate" ng-model="toDate.value" ng-model-options="{getterSetter: true}" required></sp-date-picker>
Client Controller:
api.controller=function($scope) {
/* widget controller */
var c = this;
$scope.toDate = {
value: '',
name: 'to_date',
label: 'To Date',
placeholder: ''
};
$scope.max = new Date();
$scope.min = new Date('1995-12-17T03:24:00');
};
This would allow you to specify a range of acceptable dates, dates that don't fall into this range are unavailable to your users. As of right now, these are the available options for the spDatePicker:
- field
- snDisabled
- snIncludeTime
- snChange
- snMaxDate
- snMinDate