Skip to content

Commit df56717

Browse files
committed
follow PullRequest chronotruck#167 from Original Repo.
1 parent 7ee4c2a commit df56717

File tree

9 files changed

+23
-11
lines changed

9 files changed

+23
-11
lines changed

src/VueCtkDateTimePicker/_subs/CustomButton/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}"
1111
tabindex="-1"
1212
type="button"
13-
@click.stop="$emit('click')"
13+
@click.prevent="$emit('click')"
1414
@focus="$emit('focus')"
1515
@blur="$emit('blur')"
1616
@mouseover="$emit('mouseover')"

src/VueCtkDateTimePicker/_subs/PickersContainer/_subs/ButtonValidate.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
type="button"
2828
tabindex="-1"
2929
class="datepicker-button validate flex align-center justify-content-center"
30-
@click.stop="$emit('validate')"
30+
@click.prevent="$emit('validate')"
3131
>
3232
<span
3333
class="datepicker-button-effect"

src/VueCtkDateTimePicker/_subs/PickersContainer/_subs/DatePicker/index.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
>
3434
<TransitionGroup
3535
:name="transitionLabelName"
36-
class="h-100 flex align-center flex-1 flex justify-content-right"
36+
class="h-100 flex align-center flex-1 flex"
37+
:class="reverseYMOrder ? 'justify-content-left' : 'justify-content-right'"
3738
>
3839
<CustomButton
3940
v-for="m in [month]"
@@ -49,6 +50,7 @@
4950
<TransitionGroup
5051
:name="transitionLabelName"
5152
class="h-100 flex align-center flex-1 flex"
53+
:class="reverseYMOrder ? 'justify-content-right' : 'justify-content-left'"
5254
>
5355
<CustomButton
5456
v-for="y in [year]"
@@ -185,7 +187,8 @@
185187
noShortcuts: { type: Boolean, default: null },
186188
firstDayOfWeek: { type: Number, default: null },
187189
customShortcuts: { type: Array, default: () => ([]) },
188-
visible: { type: Boolean, default: null }
190+
visible: { type: Boolean, default: null },
191+
reverseYMOrder: { type: Boolean, default: false }
189192
},
190193
data () {
191194
return {

src/VueCtkDateTimePicker/_subs/PickersContainer/_subs/HeaderPicker.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107

108108
<script>
109109
import moment from 'moment'
110+
const YEAR_REGEX = new RegExp('([/, -]+)?(YYYYY?|YY|Yr)[年년年]?([/, -]+)?')
110111
111112
export default {
112113
name: 'HeaderPicker',
@@ -139,10 +140,10 @@
139140
return date
140141
},
141142
year () {
142-
return this.dateTime.format('YYYY')
143+
return this.dateTime.year()
143144
},
144145
getDateFormatted () {
145-
return this.dateTime.format('ddd D MMM')
146+
return this.dateTime.format(moment.localeData(this.locale).longDateFormat('LL').replace(YEAR_REGEX, ''))
146147
},
147148
isFormatTwelve () {
148149
return this.format ? (this.format.indexOf('a') > -1) || (this.format.indexOf('A') > -1) : false

src/VueCtkDateTimePicker/_subs/PickersContainer/index.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:class="{'inline': inline, 'is-dark': dark, 'visible': visible}"
88
:style="responsivePosition"
99
class="datetimepicker flex"
10-
@click.stop
10+
@click.prevent.stop
1111
>
1212
<div
1313
:style="[responsivePosition, width]"
@@ -22,6 +22,7 @@
2222
:only-time="onlyTime"
2323
:format="format"
2424
:time-format="timeFormat"
25+
:locale="locale"
2526
:transition-name="transitionName"
2627
:no-time="onlyDate"
2728
:dark="dark"
@@ -52,6 +53,7 @@
5253
:custom-shortcuts="customShortcuts"
5354
:no-keyboard="noKeyboard"
5455
:locale="locale"
56+
:reverse-y-m-order="reverseYMOrder"
5557
@change-month="changeMonth"
5658
@change-year-month="changeYearMonth"
5759
@close="$emit('close')"
@@ -141,7 +143,8 @@
141143
customShortcuts: { type: Array, default: null },
142144
noKeyboard: { type: Boolean, default: false },
143145
right: { type: Boolean, default: false },
144-
behaviour: { type: Object, default: () => ({}) }
146+
behaviour: { type: Object, default: () => ({}) },
147+
reverseYMOrder: { type: Boolean, default: false }
145148
},
146149
data () {
147150
return {

src/VueCtkDateTimePicker/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div
3232
v-if="hasPickerOpen && overlay"
3333
class="time-picker-overlay"
34-
@click.stop="closePicker"
34+
@click.prevent.stop="closePicker"
3535
/>
3636

3737
<!-- Date picker container -->
@@ -71,6 +71,7 @@
7171
:no-keyboard="noKeyboard"
7272
:right="right"
7373
:behaviour="_behaviour"
74+
:reverse-y-m-order="reverseYMOrder"
7475
@validate="validate"
7576
@close="closePicker"
7677
/>

src/VueCtkDateTimePicker/modules/month.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default class Month {
1616
}
1717

1818
getFormatted () {
19-
return this.start.format('MMMM')
19+
return this.start.format('MMM')
2020
}
2121

2222
getYear () {

src/VueCtkDateTimePicker/props.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ export default {
5656
behaviour: { type: Object, default: () => ({}) },
5757
noKeyboard: { type: Boolean, default: false },
5858
right: { type: Boolean, default: false },
59-
noClearButton: { type: Boolean, default: false }
59+
noClearButton: { type: Boolean, default: false },
60+
reverseYMOrder: { type: Boolean, default: false }
6061
}

src/assets/scss/helpers/_flex.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,6 @@
146146
.flex-grow {
147147
flex-grow: 1;
148148
}
149+
.flex-direction-reversed {
150+
flex-direction: row-reverse;
151+
}

0 commit comments

Comments
 (0)