Skip to content

Commit

Permalink
Merged branch '2.3' of ezsystems/ezplatform-admin-ui into main (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz authored Feb 17, 2022
2 parents 1f5ef1f + d3a1abd commit 3994894
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/bundle/Resources/public/js/scripts/fieldType/ezdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@
return;
}

const selectedDateWithUserTimezone = ibexa.helpers.timezone.convertDateToTimezone(date[0], ibexa.adminUiConfig.timezone, true);
date = new Date(date[0]);
date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));

sourceInput.value = Math.floor(selectedDateWithUserTimezone.valueOf() / 1000);
sourceInput.value = Math.floor(date.valueOf() / 1000);
sourceInput.dispatchEvent(event);
};
const clearValue = (sourceInput, flatpickrInstance, event) => {
Expand All @@ -99,7 +100,15 @@
if (actionType === 'create') {
defaultDate.setTime(new Date().getTime());
} else if (actionType === 'edit') {
defaultDate.setTime(defaultDate.getTime());
defaultDate = new Date(
defaultDate.getUTCFullYear(),
defaultDate.getUTCMonth(),
defaultDate.getUTCDate(),
0,
0,
0,
0
);
}

updateInputValue(sourceInput, [defaultDate]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
{% block ezdate_field %}
{% apply spaceless %}
{% if not ibexa_field_is_empty( content, field ) %}
{% set field_value = field.value.date|ibexa_full_date %}
{% set field_value = field.value.date|ibexa_full_date('UTC') %}
{{ block( 'simple_block_field' ) }}
{% endif %}
{% endapply %}
Expand Down

0 comments on commit 3994894

Please # to comment.