I need help to create a datepicker that works in new UI.
The date picker that I had created for classic UI does not work in new UI.
Does someone know how to make this work?
This is my code that works for H5 classic UI
private addDatePicker() {
const textElement = new TextBoxElement();
textElement.Name = "DatePicker";
textElement.Position = new PositionElement();
textElement.Position.Top = 5;
textElement.Position.Left = 9;
textElement.Position.Width = 10;
textElement.DateFormat = "yyyyMMdd";
const now = new Date();
const today = now.toISOString().slice(2, 10);
textElement.Value = today;
let contentElement = this.controller.GetContentElement();
const $dateElem = contentElement.AddElement(textElement);
$dateElem.inforDateField({
dateFormat: "yyMMdd",
hasInitialValue: true,
openOnEnter: false,
startDate: new Date(),
beforeShow: function () {
if ($(this).val() == "") {
$(this).datepicker("setDate", new Date());
}
},
});
}