Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Commit

Permalink
Revert split date for being compatible with all locales. So, month pi…
Browse files Browse the repository at this point in the history
…cker will be shown when clicking on the date.
  • Loading branch information
mariomka committed Jan 12, 2019
1 parent e0d49b1 commit 7892362
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/DatetimePopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="vdatetime-popup">
<div class="vdatetime-popup__header">
<div class="vdatetime-popup__year" @click="showYear" v-if="type !== 'time'">{{ year }}</div>
<div class="vdatetime-popup__date" v-if="type !== 'time'">{{ dateFormattedDay }} <span @click="showMonth" class="vdatetime-popup__month">{{ dateFormattedMonth }}</span></div>
<div class="vdatetime-popup__date" @click="showMonth" v-if="type !== 'time'">{{ dateFormatted }}</div>
</div>
<div class="vdatetime-popup__body">
<datetime-year-picker
Expand Down Expand Up @@ -158,16 +158,11 @@ export default {
minute () {
return this.newDatetime.minute
},
dateFormattedDay () {
return this.newDatetime.toLocaleString({
day: 'numeric'
})
},
dateFormattedMonth () {
dateFormatted () {
return this.newDatetime.toLocaleString({
month: 'long',
day: 'numeric'
}).substr(('' + this.day).length + 1)
})
},
minDatetimeUTC () {
return this.minDatetime ? this.minDatetime.toUTC() : null
Expand Down Expand Up @@ -208,7 +203,7 @@ export default {
},
showMonth () {
this.step = 'month'
this.flow.diversion('date')
this.flowManager.diversion('date')
},
confirm () {
this.nextStep()
Expand Down Expand Up @@ -337,8 +332,4 @@ export default {
color: #444;
}
}
.vdatetime-popup__month {
cursor: pointer;
}
</style>
19 changes: 19 additions & 0 deletions test/specs/DatetimePopup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,25 @@ describe('DatetimePopup.vue', function () {
})
})

it('should render the month picker', function (done) {
const vm = createVM(this,
`<DatetimePopup :datetime="datetime"></DatetimePopup>`,
{
components: { DatetimePopup },
data () {
return {
datetime: LuxonDatetime.local()
}
}
})

vm.$('.vdatetime-popup__date').click()
vm.$nextTick(() => {
expect(vm.$('.vdatetime-popup__body .vdatetime-month-picker')).to.exist
done()
})
})

it('should render the calendar on confirm in year picker', function (done) {
const vm = createVM(this,
`<DatetimePopup :datetime="datetime"></DatetimePopup>`,
Expand Down

0 comments on commit 7892362

Please sign in to comment.