I am using a date input in my form template. It accepts a value in form of A DOMString
representing a date in YYYY-MM-DD format, or empty but Django gives me a value in dd.mm.yyyy due to localization.
Also I am using widget_teaks in my form view to add some Attributes:
{% if field|field_type == 'datefield' %}
{% render_field field|append_attr:"class:form-control dateField " type="date" %}
{% else %}
I tried to fix it in the template using jQuery but it returns just an empty string for the value:
$(document).ready(function(){
var date = $(".dateField").val();
console.log(date);
});
So I can’t just update the value accordingly. I tried to unlocalize the whole template but still the date is formated in dd.mm.yyyy.
The relevant part of the settings:
LANGUAGE_CODE = “de”
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
and the relevant Field in the Model:
naechste = models.DateField(verbose_name="nächste Prüfung")
and the Form itself:
class Massnahmen_Form(forms.ModelForm):
class Meta:
model = Massnahmen
exclude = ["version", "latest_version"]
Can you tell me what I am doing wrong?