Im trying to change the language of the date-picker dynamically. To do so, I have to change the locale
value of data-options. My plan is to use a template string to change it, whenever the variable currentLang
changes.
The problem is, that I can't escape the string properly.
It is currently looking like this:
<div class="flatpickr" data-init="auto" data-options=`{"enableTime": true, "locale" : "${currentLang}", "dateFormat" : "Y-m-d H:i:S" }`>
In the end I want the string to look like this:
data-options='{"enableTime": true, "locale": "en", "dateFormat": "Y-m-d H:i:S"}'
Is this even possible to achieve?