0 votes
926 views
in Coach Views by

1 Answer

0 votes
by (30.6k points)

The UI Toolkit Date Time Picker has options for the minimum / maximum date and, on newer toolkits, a disabled-dates option; where the option is missing, the underlying date library (Bootstrap datetimepicker on the UI Toolkit, Dojo on the old control) exposes a disabled dates / days setting you can reach in the control's load event:

// Date Time Picker "Delivery" > Events > On load   (BPM UI Toolkit: bootstrap-datetimepicker underneath)
var $el = $(me.context.element).find(".input-group, input").first().closest("[data-DateTimePicker], .date");
var picker = $el.data("DateTimePicker") || $(me.context.element).find("input").data("DateTimePicker");
if (picker) {
  picker.daysOfWeekDisabled([0, 6]);                                          // weekends
  picker.disabledDates([moment("2025-12-25"), moment("2025-12-26"), moment("2026-01-01")]);   // holidays (moment.js is bundled)
  picker.minDate(moment().startOf("day"));                                    // no past dates
}
// holidays from the server: environment variable "holidays" = "2025-12-25,2025-12-26,2026-01-01" mapped into a coach variable tw.local.holidays
var list = (${HolidaysHidden}.getData() || "").split(",").filter(function (s) { return s; }).map(function (s) { return moment(s, "YYYY-MM-DD"); });
picker.disabledDates(list);

Old Dojo date control (Coaches toolkit): set widget.constraints = { min: ..., max: ... } and widget.isDisabledDate = function(d) { return d.getDay() == 0 || d.getDay() == 6; } in the load event (get the widget with dijit.registry.byNode). Whatever the control does, validate again server-side (coach validation) - typed dates bypass the calendar.

References

Related questions

0 votes
1 answer 873 views
0 votes
1 answer 668 views
0 votes
1 answer 1.4k views
0 votes
1 answer 847 views
0 votes
1 answer 1.4k views
0 votes
1 answer 2.3k views
0 votes
1 answer 1.4k views
0 votes
1 answer 4.0k views
0 votes
1 answer 4.1k views
0 votes
1 answer 722 views
0 votes
1 answer 2.1k views
asked May 26, 2018 in Coach Views by BHAGYARAVI (320 points)

723 questions

807 answers

98 comments

4.9k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...