search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

JavaScript Scheduler Model Custome date selection

Related article: JavaScript Scheduler: How to Edit Multiple Fields using a Modal Dialog
Asked by Anonymous
1 year ago.

How to set Custome date in DayPilot.Modal.form (how to add calendar selected add in this input type form)

Answer posted by Dan Letecky [DayPilot]
1 year ago.

You can use the "dateFormat" property of the date field:

const resources = [
  {name: "Resource A", id: "A"},
  {name: "Resource B", id: "B"},
  {name: "Resource C", id: "C"},
];

const form = [
  {name: "Text", id: "text"},
  {name: "Start", id: "start", type: "date", dateFormat: "d MMMM yyyy"},
  {name: "End", id: "end", type: "date", dateFormat: "d MMMM yyyy"},
  {name: "Resource", id: "resource", options: resources},
];

const data = {
  text: "Event 1",
  start: "2023-11-01",
  end: "2023-11-02",
  resource: "B"
};

const options = {
  locale: "de-de"
};

DayPilot.Modal.form(form, data, options).then(function(modal) {
  console.log(modal);
});

If you specify a custom locale using "options" the modal dialog will use the date pattern from the locale as the default one.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.