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

An Empty Scheduler Error

Asked by Anonymous
21 days ago.

If a Scheduler has no events we keep getting the following error:

Uncaught TypeError: Cannot read properties of undefined (reading 'datePattern')

Any idea what this means?
Thanks

Answer posted by Dan Letecky [DayPilot]
21 days ago.

datePattern is a property of DayPilot.Locale. You might want to check the locale value - it must be either a DayPilot.Locale object or a string identifier of a registered locale.

Comment posted by Anonymous
21 days ago.

You are absolutely right.

However, in international apps there is the possibility of have just say en as opposed to en-us or en-gb.

Is there any way of registering additional locales?

Thanks

Comment posted by Anonymous
21 days ago.

Can we for example say to register that en=en-gb etc.

Comment posted by Dan Letecky [DayPilot]
20 days ago.

You can register an alias like this:

DayPilot.Locale.register("en", DayPilot.Locale.find("en-gb"));

You can also create and register your own locale:

DayPilot.Locale.register(
  new DayPilot.Locale("en-gb", {
    dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
    dayNamesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
    monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
    monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
    timePattern: "HH:mm",
    datePattern: "dd/MM/yyyy",
    dateTimePattern: "dd/MM/yyyy HH:mm",
    timeFormat: "Clock24Hours",
    weekStarts: 1
  })
);
Comment posted by Anonymous
20 days ago.

We tried:
DayPilot.Locale.register("en", DayPilot.Locale.find("en-us"));

But it does not work and still gives us the same error.

Comment posted by Anonymous
20 days ago.

We really would appreciate a solution to this.

The locale is so important in your library that it simply breaks EVERYTHING if not formatted correctly and there are numerouse situations where only the language is specified without the region.

The code which you sent us earlier seems to be ideal but unfortunately does not work:
DayPilot.Locale.register("en", DayPilot.Locale.find("en-gb"));

Thanks in advance for your assistance.

Comment posted by Dan Letecky [DayPilot]
18 days ago.

Sorry, the alias registration syntax used above is incorrect. It is necessary to copy the locale properties like this:

DayPilot.Locale.register(new DayPilot.Locale(null, {
    ...DayPilot.Locale.find("en-us"),
    id: "en",
}));
New Reply
This reply is
Attachments:
or drop files here
Your name (optional):