@afeefa/vue-app 0.0.165 → 0.0.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.167
|
package/package.json
CHANGED
@@ -178,9 +178,19 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
178
178
|
}
|
179
179
|
|
180
180
|
get date () {
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
if (!this.value_) {
|
182
|
+
return null
|
183
|
+
}
|
184
|
+
|
185
|
+
return this.dateToString(this.value_).substr(0, this.type === 'month' ? 7 : 10)
|
186
|
+
}
|
187
|
+
|
188
|
+
dateToString (date) {
|
189
|
+
// format date to v-date-picker compatible string: https://stackoverflow.com/a/29774197
|
190
|
+
// respecting and adding local time zone time shift to the utc iso string
|
191
|
+
const offset = date.getTimezoneOffset()
|
192
|
+
date = new Date(date.getTime() - (offset * 60 * 1000))
|
193
|
+
return date.toISOString()
|
184
194
|
}
|
185
195
|
|
186
196
|
get label () {
|
@@ -202,12 +212,22 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
202
212
|
this.dateChanged(null)
|
203
213
|
} else if (this.validateTextInput(value)) {
|
204
214
|
const [day, month, year] = value.split('.')
|
205
|
-
|
215
|
+
const date = new Date(year + '-' + month + '-' + day)
|
216
|
+
this.dateChanged(this.dateToString(date).split('T')[0])
|
206
217
|
}
|
207
218
|
}
|
208
219
|
|
209
|
-
dateChanged (date) {
|
210
|
-
|
220
|
+
dateChanged (date) { // date is a yyyy-mm or yyyy-mm-dd string
|
221
|
+
if (date) {
|
222
|
+
// take given date string an create a local time date object
|
223
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format
|
224
|
+
// > When the time zone offset is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as local time.
|
225
|
+
const dateStringThatGetsConvertedToLocalDate = date + 'T00:00'
|
226
|
+
this.value_ = new Date(dateStringThatGetsConvertedToLocalDate)
|
227
|
+
} else {
|
228
|
+
this.value_ = null
|
229
|
+
}
|
230
|
+
|
211
231
|
this.validate()
|
212
232
|
|
213
233
|
this.close()
|
@@ -223,7 +243,7 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
223
243
|
const monthName = date.toLocaleString('default', { month: 'long' })
|
224
244
|
return monthName + ' ' + date.getFullYear()
|
225
245
|
}
|
226
|
-
return formatDate(
|
246
|
+
return formatDate(date)
|
227
247
|
}
|
228
248
|
|
229
249
|
validate () {
|
@@ -76,7 +76,6 @@ export default class FlyingContextContainer extends Vue {
|
|
76
76
|
|
77
77
|
this.visible = !!container.children.length
|
78
78
|
const isOpening = mutationRecords.length === 1 && mutationRecords[0].addedNodes.length === 1 // only 1 record ... and this one is 'added'
|
79
|
-
console.log(mutationRecords)
|
80
79
|
|
81
80
|
const el = document.documentElement
|
82
81
|
|