hariniparth
(Harini Parthasarathy)
August 29, 2017, 3:42am
1
Hello,
I am using the datetimepicker provided by the UICOMMONS module and trying to find a way to set the earliest start date value.
${ ui.includeFragment(“uicommons”, “field/datetimepicker”, [ id: ‘startDate’, label: ‘’, formFieldName: ‘startDate’, useTime: ‘’, defaultDate: startDate ]) }
However, since I cannot set a minDate property here and nor can I detect the value selected in this field using jQuery, I am not sure what I can do.
Could someone please suggest if there is any onSelect or onClick method (or similar) that I can apply here? Is there any other option?
Thanks!!
darius
(Darius Jazayeri)
August 29, 2017, 1:55pm
2
Peeking at the code in this file:
<%
ui.includeJavascript("uicommons", "datetimepicker/bootstrap-datetimepicker.min.js")
if(org.openmrs.api.context.Context.getLocale().getLanguage() != "en"){
ui.includeJavascript("uicommons", "datetimepicker/locales/bootstrap-datetimepicker.${ org.openmrs.api.context.Context.getLocale() }.js")
}
ui.includeCss("uicommons", "datetimepicker.css")
config.require("id", "label", "formFieldName", "useTime")
def required = config.classes && config.classes.contains("required")
def dateStringFormat
def dateISOFormatted
if (config.useTime) {
dateStringFormat = new java.text.SimpleDateFormat("dd MMM yyyy HH:mm", org.openmrs.api.context.Context.getLocale())
dateISOFormatted = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
} else {
dateStringFormat = new java.text.SimpleDateFormat("dd MMM yyyy", org.openmrs.api.context.Context.getLocale())
dateISOFormatted = new java.text.SimpleDateFormat("yyyy-MM-dd")
This file has been truncated. show original
… it looks like you can provide startDate and endDate config parameters
to the widget.
hariniparth
(Harini Parthasarathy)
August 30, 2017, 2:08am
3
Thanks Darius for the response. However, my concern is that, it widget allows me a select a start date earlier than the current date. I want to set a minDate property like the one that can be set in common datetimepickers using javascript.