Skip to content

Commit 3f06a75

Browse files
committed
feat(QDate): "@input" details now contain year/month/day of date where user clicked/tapped even when adding/removing a range
1 parent 0013c3b commit 3f06a75

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

ui/src/components/date/QDate.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ export default Vue.extend({
11911191
const dayProps = this.days.find(day => day.fill !== true && day.i === dayIndex)
11921192

11931193
if (dayProps.range !== void 0) {
1194-
this.__removeFromModel({ from: dayProps.range.from, to: dayProps.range.to })
1194+
this.__removeFromModel({ target: day, from: dayProps.range.from, to: dayProps.range.to })
11951195
return
11961196
}
11971197

@@ -1220,7 +1220,7 @@ export default Vue.extend({
12201220
: { from: day, to: this.editRange.init }
12211221

12221222
this.editRange = void 0
1223-
this.__addToModel(initHash === finalHash ? day : payload)
1223+
this.__addToModel(initHash === finalHash ? day : { target: day, ...payload })
12241224

12251225
this.$emit('range-end', {
12261226
from: this.__getPublicData(payload.from),
@@ -1291,13 +1291,14 @@ export default Vue.extend({
12911291
? {
12921292
reason: `${action}-range`,
12931293
details: {
1294-
from: { year: date.from.year, month: date.from.month, day: date.from.day },
1295-
to: { year: date.to.year, month: date.to.month, day: date.to.day }
1294+
...this.__getPublicData(date.target),
1295+
from: this.__getPublicData(date.from),
1296+
to: this.__getPublicData(date.to)
12961297
}
12971298
}
12981299
: {
12991300
reason: `${action}-day`,
1300-
details: { year: date.year, month: date.month, day: date.day }
1301+
details: this.__getPublicData(date)
13011302
}
13021303
},
13031304

ui/src/components/date/QDate.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,22 +175,22 @@
175175
"definition": {
176176
"year": {
177177
"type": "Number",
178-
"desc": "The year of the date (if non-range)",
178+
"desc": "The year of the date that the user has clicked/tapped on",
179179
"__exemption": [ "examples" ]
180180
},
181181
"month": {
182182
"type": "Number",
183-
"desc": "The month of the date (if non-range)",
183+
"desc": "The month of the date that the user has clicked/tapped on",
184184
"__exemption": [ "examples" ]
185185
},
186186
"day": {
187187
"type": "Number",
188-
"desc": "The day of month (if non-range)",
188+
"desc": "The day of the month that the user has clicked/tapped on",
189189
"__exemption": [ "examples" ]
190190
},
191191
"from": {
192192
"type": "Object",
193-
"desc": "Object of properties of the range starting point",
193+
"desc": "Object of properties of the range starting point (only if range)",
194194
"definition": {
195195
"year": {
196196
"type": "Number",
@@ -212,7 +212,7 @@
212212
},
213213
"to": {
214214
"type": "Object",
215-
"desc": "Object of properties of the range ending point",
215+
"desc": "Object of properties of the range ending point (only if range)",
216216
"definition": {
217217
"year": {
218218
"type": "Number",

0 commit comments

Comments
 (0)