diff --git a/src/App.vue b/src/App.vue index 856c6bdb..ba3bc0fa 100644 --- a/src/App.vue +++ b/src/App.vue @@ -232,7 +232,6 @@ background-color: #FFF; color: #bd4147; border: 1px solid #CCC; - /* display: inline-block; */ border-radius: 4px; outline: none; font-size: 85%; diff --git a/src/vue-ctk-date-time-picker/_subs/CtkDatePickerAgenda.vue b/src/vue-ctk-date-time-picker/_subs/CtkDatePickerAgenda.vue index 550967e1..5462c221 100644 --- a/src/vue-ctk-date-time-picker/_subs/CtkDatePickerAgenda.vue +++ b/src/vue-ctk-date-time-picker/_subs/CtkDatePickerAgenda.vue @@ -222,17 +222,14 @@ return moment(this.dateTime).locale(this.locale).format('ddd D MMM') }, selectTime (dateTime) { - this.transitionDayName = 'slidevprev' - if (dateTime > this.dateTime) { - this.transitionDayName = 'slidevnext' - } + const isBigger = dateTime > this.dateTime + this.transitionDayName = isBigger ? 'slidevnext' : 'slidevprev' this.$emit('change-date', dateTime) }, selectDate (dateTime) { - this.transitionDayName = 'slidevnext' - if (dateTime.isBefore(this.dateTime)) { - this.transitionDayName = 'slidevprev' - } + const isBefore = dateTime.isBefore(this.dateTime) + this.transitionDayName = isBefore ? 'slidevprev' : 'slidevnext' + dateTime.add(this.dateTime.hour(), 'hours') dateTime.add(this.dateTime.minute(), 'minutes') this.$emit('change-date', dateTime) @@ -250,18 +247,13 @@ this.$emit('validate') }, dateTimeWidth () { - let width - let result - if (this.$refs.timePickerComponent && this.$refs.timePickerComponent.$el.clientWidth) { - width = this.$refs.timePickerComponent.$el.clientWidth - } else { - width = 160 - } - result = { - flex: '0 0 ' + width + 'px', - width: width + 'px', - minWidth: width + 'px', - maxWidth: width + 'px' + const timePickerComponentPresent = this.$refs.timePickerComponent && this.$refs.timePickerComponent.$el.clientWidth + const width = timePickerComponentPresent ? this.$refs.timePickerComponent.$el.clientWidth : 160 + const result = { + flex: `0 0 ${width}px`, + width: `${width}px`, + minWidth: `${width}px`, + maxWidth: `${width}px` } return result } diff --git a/src/vue-ctk-date-time-picker/_subs/_subs/CtkDatePicker.vue b/src/vue-ctk-date-time-picker/_subs/_subs/CtkDatePicker.vue index 191865e5..0f2223af 100644 --- a/src/vue-ctk-date-time-picker/_subs/_subs/CtkDatePicker.vue +++ b/src/vue-ctk-date-time-picker/_subs/_subs/CtkDatePicker.vue @@ -135,11 +135,9 @@ } }, endEmptyDays () { - if ((this.monthDays.length + this.weekDay) > 35) { - return 42 - this.monthDays.length - this.weekDay - } else { - return 35 - this.monthDays.length - this.weekDay - } + const getDays = (this.monthDays.length + this.weekDay) > 35 + const number = getDays ? 42 : 35 + return number - this.monthDays.length - this.weekDay }, monthDays () { return this.month.getMonthDays() @@ -174,13 +172,14 @@ this.$emit('change-date', day) }, changeMonth (val) { - this.transitionDaysName = 'slide' + val - this.transitionLabelName = 'slidev' + val + this.transitionDaysName = `slide${val}` + this.transitionLabelName = `slidev${val}` this.$emit('change-month', val) } } } +