Skip to content

Commit 7443184

Browse files
committed
Added change year list step
1 parent 7e6ca79 commit 7443184

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ ___
145145
| isTypeable | Boolean | false | true | Enable manually date typing function, working only with prop isModal |
146146
| changeMonthFunction | Boolean | false | true | Enable changed month with list, function |
147147
| changeYearFunction | Boolean | false | true | Enable changed year with list, function |
148+
| changeYearStep | Number | 12 | 6 | Change year list step count |
148149
| applyStylesheet | Boolean | true | false | Disable default styles |
149150
| markedDates | Array | [] | ['10/12/2018', '12/12/2018'] OR [{date: '10/1/2019', class: 'marked-class'},{date: '12/1/2019', class: 'marked-class-2'}] | Marked dates array |
150151
| markedDateRange | Object | {start: false, end: false} | {start: '12/12/2018', end: '20/12/2018'} | Marked date with range |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"name": "vue-functional-calendar",
88
"description": "Lightweight, high-performance calendar component based on Vue.js",
9-
"version": "2.5.8",
9+
"version": "2.5.9",
1010
"license": "MIT",
1111
"repository": {
1212
"type": "git",

src/Demo.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
:disabled-dates="['10/10/2019']"
1414
v-slot:default="props"
1515
:is-auto-closeable="true"
16-
:is-modal="true"
16+
:is-modal="false"
17+
:change-year-step="5"
1718
>
1819
<span style="text-align: center">
1920
{{ props.day.day }}

src/components/FunctionalCalendar.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div :class="{'vfc-styles-conditional-class': fConfigs.applyStylesheet}">
3-
<div class="vfc-multiple-input" :class="{'vfc-dark': fConfigs.isDark}" v-if="fConfigs.isModal && fConfigs.isDateRange">
3+
<div class="vfc-multiple-input" :class="{'vfc-dark': fConfigs.isDark}"
4+
v-if="fConfigs.isModal && fConfigs.isDateRange">
45
<input type="text" title="Start Date"
56
v-model="input.dateRange.start.date"
67
:placeholder="fConfigs.placeholder"
@@ -707,7 +708,9 @@
707708
if (!this.allowPreDate)
708709
return false;
709710
710-
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() - 1, this.calendar.currentDate.getMonth());
711+
let step = this.showYearPicker ? this.fConfigs.changeYearStep : 1;
712+
713+
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() - step, this.calendar.currentDate.getMonth());
711714
this.initCalendar();
712715
this.$emit('changedYear', this.calendar.currentDate);
713716
},
@@ -718,7 +721,9 @@
718721
if (!this.allowNextDate)
719722
return false;
720723
721-
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() + 1, this.calendar.currentDate.getMonth());
724+
let step = this.showYearPicker ? this.fConfigs.changeYearStep : 1;
725+
726+
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() + step, this.calendar.currentDate.getMonth());
722727
this.initCalendar();
723728
this.$emit('changedYear', this.calendar.currentDate);
724729
},

src/mixins/propsAndData.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ export const propsAndData = {
5959
type: Boolean,
6060
default: () => false
6161
},
62+
changeYearStep: {
63+
type: Number,
64+
default: () => 12
65+
},
6266
applyStylesheet: {
6367
type: Boolean,
6468
default: () => true
@@ -182,6 +186,7 @@ export const propsAndData = {
182186

183187
changeMonthFunction: false,
184188
changeYearFunction: false,
189+
changeYearStep: 12,
185190

186191
applyStylesheet: true,
187192

0 commit comments

Comments
 (0)