@afeefa/vue-app 0.0.165 → 0.0.166
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.166
|
package/package.json
CHANGED
@@ -178,9 +178,15 @@ 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
|
+
// format date to v-date-picker compatible string: https://stackoverflow.com/a/29774197
|
186
|
+
const offset = this.value_.getTimezoneOffset()
|
187
|
+
let date = new Date(this.value_.getTime() - (offset * 60 * 1000))
|
188
|
+
date = date.toISOString().substr(0, this.type === 'month' ? 7 : 10)
|
189
|
+
return date
|
184
190
|
}
|
185
191
|
|
186
192
|
get label () {
|
@@ -207,7 +213,16 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
207
213
|
}
|
208
214
|
|
209
215
|
dateChanged (date) {
|
210
|
-
|
216
|
+
if (date) {
|
217
|
+
// take given date string an create a local time date object
|
218
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format
|
219
|
+
// > 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.
|
220
|
+
const dateStringThatGetsConvertedToLocalDate = date + 'T00:00'
|
221
|
+
this.value_ = new Date(dateStringThatGetsConvertedToLocalDate)
|
222
|
+
} else {
|
223
|
+
this.value_ = null
|
224
|
+
}
|
225
|
+
|
211
226
|
this.validate()
|
212
227
|
|
213
228
|
this.close()
|
@@ -223,7 +238,7 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
223
238
|
const monthName = date.toLocaleString('default', { month: 'long' })
|
224
239
|
return monthName + ' ' + date.getFullYear()
|
225
240
|
}
|
226
|
-
return formatDate(
|
241
|
+
return formatDate(date)
|
227
242
|
}
|
228
243
|
|
229
244
|
validate () {
|