Skip to content

Commit

Permalink
Merge pull request #76 from Xpirix/fix_datetime_format
Browse files Browse the repository at this point in the history
Remove second in feed form, change displayed format in the list
  • Loading branch information
Xpirix authored May 23, 2024
2 parents 461fda1 + 2177a69 commit c3c3890
Show file tree
Hide file tree
Showing 5 changed files with 5,692 additions and 4 deletions.
2 changes: 2 additions & 0 deletions qgisfeedproject/qgisfeed/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def __init__(self, *args, **kwargs):
'default_zoom': 2
})
self.fields['publish_from'].widget = forms.DateTimeInput(
format='%Y-%m-%dT%H:%M',
attrs={
'type': 'datetime-local',
'class': 'input',
Expand All @@ -133,6 +134,7 @@ def __init__(self, *args, **kwargs):
self.fields['publish_from'].initial = timezone.now()

self.fields['publish_to'].widget = forms.DateTimeInput(
format='%Y-%m-%dT%H:%M',
attrs={
'type': 'datetime-local',
'class': 'input',
Expand Down
4 changes: 2 additions & 2 deletions qgisfeedproject/static/js/feed_item_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ function refreshSpatialFilter() {
function refreshDates() {
publishFromPreview.forEach((item) => {
item.innerText = publishFromField.value
? new Date(publishFromField.value).toString()
? moment(new Date(publishFromField.value)).format('ddd DD MMM YYYY HH:mm:ss [UTC]')
: "-";
});
publishToPreview.forEach((item) => {
item.innerText = publishToField.value
? new Date(publishToField.value).toString()
? moment(new Date(publishToField.value)).format('ddd DD MMM YYYY HH:mm:ss [UTC]')
: "-";
});
checkFormValid();
Expand Down
Loading

0 comments on commit c3c3890

Please sign in to comment.