Skip to content

Commit 65c6181

Browse files
authored
Merge pull request #48 from annisaprida/master
fix broken page (remove unnecessary init range on created) and resolve conflict
2 parents 76bc946 + 09492ae commit 65c6181

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/RangedatePicker.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="calendar" :class="{'calendar-mobile ': isCompact, 'calendar-right-to-left': isRighttoLeft}" v-if="isOpen">
55
<div class="calendar-head" v-if="!isCompact">
66
<h2>{{captions.title}}</h2>
7-
<i class="close" @click="toggleCalendar()"></i>
7+
<i class="close" @click="toggleCalendar()">&times</i>
88
</div>
99
<div class="calendar-wrap">
1010
<div class="calendar_month_left" :class="{'calendar-left-mobile': isCompact}" v-if="showMonth">
@@ -132,12 +132,12 @@
132132
cursor: pointer;
133133
}
134134
135-
.close::after {
136-
content: "";
137-
font-style: normal;
135+
.close{
138136
float: right;
139-
padding: 10px;
137+
padding: 0 10px;
140138
margin-top: -35px;
139+
font-size: 32px;
140+
font-weight: normal;
141141
}
142142
143143
.calendar ul {

src/js/rangedate-picker.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ export default {
188188
}
189189
},
190190
created () {
191-
this.dateRange = this.initRange || null
192191
if (this.isCompact) {
193192
this.isOpen = true
194193
}
@@ -270,15 +269,15 @@ export default {
270269
// bound by > 0 and < last day of month
271270
return result > 0 && result <= endMonthDate ? result : '&nbsp;'
272271
},
273-
getNewDateRange (result, activeMonth) {
272+
getNewDateRange (result, activeMonth, activeYear) {
274273
const newData = {}
275274
let key = 'start'
276275
if (!this.isFirstChoice) {
277276
key = 'end'
278277
} else {
279278
newData['end'] = null
280279
}
281-
const resultDate = new Date(this.activeYearStart, activeMonth, result)
280+
const resultDate = new Date(activeYear, activeMonth, result)
282281
if (!this.isFirstChoice && resultDate < this.dateRange.start) {
283282
this.isFirstChoice = false
284283
return { start: resultDate }
@@ -291,7 +290,8 @@ export default {
291290
},
292291
selectFirstItem (r, i) {
293292
const result = this.getDayIndexInMonth(r, i, this.startMonthDay) + 1
294-
this.dateRange = Object.assign({}, this.dateRange, this.getNewDateRange(result, this.activeMonthStart))
293+
this.dateRange = Object.assign({}, this.dateRange, this.getNewDateRange(result, this.activeMonthStart,
294+
this.activeYearStart))
295295
if (this.dateRange.start && this.dateRange.end) {
296296
this.presetActive = ''
297297
if (this.isCompact) {
@@ -301,7 +301,8 @@ export default {
301301
},
302302
selectSecondItem (r, i) {
303303
const result = this.getDayIndexInMonth(r, i, this.startNextMonthDay) + 1
304-
this.dateRange = Object.assign({}, this.dateRange, this.getNewDateRange(result, this.startNextActiveMonth))
304+
this.dateRange = Object.assign({}, this.dateRange, this.getNewDateRange(result, this.startNextActiveMonth,
305+
this.activeYearEnd))
305306
if (this.dateRange.start && this.dateRange.end) {
306307
this.presetActive = ''
307308
}

0 commit comments

Comments
 (0)