If no day of month, set the first day of the month

This commit is contained in:
Yohann D'ANELLO 2020-10-03 15:15:35 +02:00
parent 665f7a2875
commit 80c520d76c
1 changed files with 2 additions and 0 deletions

View File

@ -147,6 +147,8 @@ class MediaAdminForm(ModelForm):
if 'publishedDate' in info:
if "-" not in info["publishedDate"]:
info["publishedDate"] += "-01-01"
elif len(info["publishedDate"]) == 7:
info["publishedDate"] += "-01"
self.cleaned_data['publish_date'] = info['publishedDate'][:10]
if 'authors' not in self.cleaned_data \