0 votes
1.4k views
in IBM BPM Infrastructure by (260 points)

1 Answer

0 votes
ago by (30.6k points)

The date picker controls give you a minimum / maximum, and for anything else the validate event:

UI Toolkit (Spark) Date Time Picker - options Minimum date / Maximum date accept a formula, so "today" is new Date(); the picker greys out earlier days and refuses typed values:

// Date Time Picker "DueDate" > Configuration > Minimum date (formula)
new Date(new Date().setHours(0,0,0,0))
// or at run time from a script / event
${DueDate}.setMinDate ? ${DueDate}.setMinDate(new Date()) : ${DueDate}.context.options.minDate.set("value", new Date());

Heritage / Coaches toolkit Date Selector (Dojo) (BPM 8.5.7 "Date Time Picker" of the old toolkit) - no min option; set it on the underlying Dojo widget in the view's load event:

// coach view load handler wrapping the old Date Time Picker
var _this = this;
require(["dijit/registry"], function (registry) {
  var node = _this.context.element.querySelector(".dijitDateTextBox");
  var widget = node && registry.byNode(node);
  if (widget) widget.constraints = { min: new Date() };      // disables previous dates in the calendar
});

Server-side safety: validate again in the coach validation script (if (new Date(tw.local.dueDate) < today) tw.system.coachValidation.addValidationError("tw.local.dueDate", "Date must not be in the past")) - client rules can be bypassed. For blacking out weekends / holidays see question 145.

References

Related questions

0 votes
1 answer 2.9k views
0 votes
1 answer 1.3k views
0 votes
1 answer 794 views
0 votes
1 answer 881 views
0 votes
1 answer 2.1k views
asked Aug 22, 2023 by sanjay_hdi (360 points)
0 votes
1 answer 2.2k views
0 votes
1 answer 1.7k views
0 votes
1 answer 2.2k views
asked Dec 22, 2016 in Interview Questions by Anil Singh (30.6k points)
0 votes
1 answer 947 views
asked Apr 15, 2019 in Coach Views by taurora (530 points)
0 votes
1 answer 1.3k views

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
...