diff --git a/app/javascript/vue/repository_filter/filters/repositoryDateRangeValue.vue b/app/javascript/vue/repository_filter/filters/repositoryDateRangeValue.vue index 59306c24a..a8eda75aa 100644 --- a/app/javascript/vue/repository_filter/filters/repositoryDateRangeValue.vue +++ b/app/javascript/vue/repository_filter/filters/repositoryDateRangeValue.vue @@ -55,6 +55,7 @@ }, methods: { formattedDate(date) { + if (!date) return null return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}` } } diff --git a/app/javascript/vue/repository_filter/filters/repositoryDateTimeRangeValue.vue b/app/javascript/vue/repository_filter/filters/repositoryDateTimeRangeValue.vue index 87869263f..0cf0a330b 100644 --- a/app/javascript/vue/repository_filter/filters/repositoryDateTimeRangeValue.vue +++ b/app/javascript/vue/repository_filter/filters/repositoryDateTimeRangeValue.vue @@ -57,6 +57,7 @@ }, methods: { formattedDate(date) { + if (!date) return null return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}` } } diff --git a/app/javascript/vue/repository_filter/filters/repositoryDateTimeValue.vue b/app/javascript/vue/repository_filter/filters/repositoryDateTimeValue.vue index 0814775a2..87e7f2bb8 100644 --- a/app/javascript/vue/repository_filter/filters/repositoryDateTimeValue.vue +++ b/app/javascript/vue/repository_filter/filters/repositoryDateTimeValue.vue @@ -78,6 +78,7 @@ }, methods: { formattedDate(date) { + if (!date) return null return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}` } } diff --git a/app/javascript/vue/repository_filter/filters/repositoryDateValue.vue b/app/javascript/vue/repository_filter/filters/repositoryDateValue.vue index 42e789260..8ace436ae 100644 --- a/app/javascript/vue/repository_filter/filters/repositoryDateValue.vue +++ b/app/javascript/vue/repository_filter/filters/repositoryDateValue.vue @@ -76,6 +76,7 @@ }, methods: { formattedDate(date) { + if (!date) return null return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}` } } diff --git a/app/javascript/vue/repository_filter/filters/repositoryTimeRangeValue.vue b/app/javascript/vue/repository_filter/filters/repositoryTimeRangeValue.vue index b88ccb0cd..1d79c60aa 100644 --- a/app/javascript/vue/repository_filter/filters/repositoryTimeRangeValue.vue +++ b/app/javascript/vue/repository_filter/filters/repositoryTimeRangeValue.vue @@ -57,6 +57,7 @@ }, methods: { formattedDate(date) { + if (!date) return null return `${date.getHours()}:${date.getMinutes()}` } } diff --git a/app/javascript/vue/repository_filter/filters/repositoryTimeValue.vue b/app/javascript/vue/repository_filter/filters/repositoryTimeValue.vue index 1e31c6df3..197b1adf8 100644 --- a/app/javascript/vue/repository_filter/filters/repositoryTimeValue.vue +++ b/app/javascript/vue/repository_filter/filters/repositoryTimeValue.vue @@ -59,6 +59,7 @@ }, methods: { formattedDate(date) { + if (!date) return null return `${date.getHours()}:${date.getMinutes()}` } } diff --git a/app/javascript/vue/shared/date_time_picker.vue b/app/javascript/vue/shared/date_time_picker.vue index 3b827db45..92bfa1ded 100644 --- a/app/javascript/vue/shared/date_time_picker.vue +++ b/app/javascript/vue/shared/date_time_picker.vue @@ -53,8 +53,8 @@ }, recalcTimestamp() { let date = this.timeOnly ? new Date() : this.date; - if (this.isValidDate(date)) { - if (!this.isValidTime()) { + if (this.isValidDate(date) && (this.dateOnly || this.isValidTime())) { + if (this.dateOnly) { date.setHours(0); date.setMinutes(0); } else {