Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Proper date picker configuration

Michał Ociepka335d994e9551
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.py
index 75231685bd..decb32c7d8 100644
--- a/saleor/dashboard/product/forms.py
+++ b/saleor/dashboard/product/forms.py
@@ -37,9 +37,6 @@ class StockForm(forms.ModelForm):
class ProductForm(forms.ModelForm):
- available_on_submit = forms.DateField(widget=forms.HiddenInput(),
- input_formats=['%Y/%m/%d'],
- required=False)
class Meta:
model = Product
@@ -56,16 +53,6 @@ class ProductForm(forms.ModelForm):
field = self.fields['attributes']
field.widget.attrs['data-placeholder'] = pgettext_lazy(
'Product form labels', 'Search')
- if self.instance.available_on:
- self.fields['available_on'].widget.attrs[
- 'datavalue'] = self.instance.available_on.strftime('%Y/%m/%d')
-
- def clean(self):
- data = super(ProductForm, self).clean()
- data['available_on'] = data.get('available_on_submit')
- if data['available_on'] and 'available_on' in self._errors:
- del self._errors['available_on']
- return data
class ProductVariantForm(forms.ModelForm):
diff --git a/saleor/static/js_src/dashboard.jsx b/saleor/static/js_src/dashboard.jsx
index b2bb08ad9b..905f265d77 100644
--- a/saleor/static/js_src/dashboard.jsx
+++ b/saleor/static/js_src/dashboard.jsx
@@ -173,9 +173,9 @@ $('.switch-actions').on('change', function() {
});
$('.datepicker').pickadate({
format: 'd mmmm yyyy',
- formatSubmit: 'yyyy/mm/dd',
- selectYears: 15,
- selectMonths: true
+ formatSubmit: 'yyyy-mm-dd',
+ selectMonths: true,
+ hiddenName: true
});
function initSelects() {
$('select:not(.browser-default):not([multiple])').material_select();