Topic: Datepicker Attribut data-mdb-weekdays-narrow error

info@comedius.de priority asked 1 year ago


Hi,I am using mdboostrap 5 version 4.3.0 and have the following problem. If I set the options per attribute in a Datepicker component as follows, it works very well, e.g. with the title or the format:

data-mdb-format="dd.mm.yyyy" data-mdb-cancel-btn-text="Abbrechen" (that works fine)

If I want to set the option "weekdaysNarrow" as an attribute-option...data-mdb-weekdays-narrow="['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa']"

...the error always comes up:

Uncaught Error: DATEPICKER: Option "weekdaysNarrow" provided type "string" but expected type "array".

How i can pass option array-parameters (e.g. weekdaysNarrow, monthsFull, monthsShort, weekdaysFull, weekdaysNarrow, weekdaysShort) with attributes to datepicker component cleanly and without errors?

Kind regards,Stefan


Kamila Pieńkowska staff answered 1 year ago


You cannot use data attributes for datepicker translations. Arrays cannot be passed through HTML. You need to follow the translation example and use JS: https://mdbootstrap.com/docs/standard/forms/datepicker/#section-translations



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 4.3.0
  • Device: Desktop, Tablet, Mobil
  • Browser: All Browser
  • OS: Windows 11 Pro and other Versions
  • Provided sample code: No
  • Provided link: No