mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2025-01-02 21:35:16 +00:00
Issue #1571: Fix null check before use
This commit is contained in:
parent
3d7ffbf5ca
commit
42c98be036
1 changed files with 12 additions and 8 deletions
|
@ -1235,14 +1235,18 @@ const endsOn = ref(new Date());
|
||||||
|
|
||||||
const updateEventDateRelatedToTimezone = () => {
|
const updateEventDateRelatedToTimezone = () => {
|
||||||
// update event.value.beginsOn taking care of timezone
|
// update event.value.beginsOn taking care of timezone
|
||||||
const dateBeginsOn = new Date(beginsOn.value.getTime());
|
if (beginsOn.value) {
|
||||||
dateBeginsOn.setUTCMinutes(dateBeginsOn.getUTCMinutes() - tzOffset.value);
|
const dateBeginsOn = new Date(beginsOn.value.getTime());
|
||||||
event.value.beginsOn = dateBeginsOn.toISOString();
|
dateBeginsOn.setUTCMinutes(dateBeginsOn.getUTCMinutes() - tzOffset.value);
|
||||||
|
event.value.beginsOn = dateBeginsOn.toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
// update event.value.endsOn taking care of timezone
|
if (endsOn.value) {
|
||||||
const dateEndsOn = new Date(endsOn.value.getTime());
|
// update event.value.endsOn taking care of timezone
|
||||||
dateEndsOn.setUTCMinutes(dateEndsOn.getUTCMinutes() - tzOffset.value);
|
const dateEndsOn = new Date(endsOn.value.getTime());
|
||||||
event.value.endsOn = dateEndsOn.toISOString();
|
dateEndsOn.setUTCMinutes(dateEndsOn.getUTCMinutes() - tzOffset.value);
|
||||||
|
event.value.endsOn = dateEndsOn.toISOString();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(beginsOn, (newBeginsOn) => {
|
watch(beginsOn, (newBeginsOn) => {
|
||||||
|
@ -1282,7 +1286,7 @@ So you cannot check consistensy in real time, only onBlur because of the moment
|
||||||
*/
|
*/
|
||||||
const consistencyBeginsOnBeforeEndsOn = () => {
|
const consistencyBeginsOnBeforeEndsOn = () => {
|
||||||
// Update endsOn to make sure endsOn is later than beginsOn
|
// Update endsOn to make sure endsOn is later than beginsOn
|
||||||
if (endsOn.value && endsOn.value <= beginsOn.value) {
|
if (endsOn.value && beginsOn.value && endsOn.value <= beginsOn.value) {
|
||||||
const newEndsOn = new Date(beginsOn.value);
|
const newEndsOn = new Date(beginsOn.value);
|
||||||
newEndsOn.setUTCHours(beginsOn.value.getUTCHours() + 1);
|
newEndsOn.setUTCHours(beginsOn.value.getUTCHours() + 1);
|
||||||
endsOn.value = newEndsOn;
|
endsOn.value = newEndsOn;
|
||||||
|
|
Loading…
Reference in a new issue