Topic: Datepicker Attribut data-mdb-weekdays-narrow error
email@example.com priority asked 1 month 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?
kpienkowska staff answered 1 month 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
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: 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