@afeefa/vue-app 0.0.315 → 0.0.317
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.317
|
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@ import { PositionConfig } from '../services/PositionService'
|
|
|
54
54
|
import { randomCssClass } from '../utils/random'
|
|
55
55
|
|
|
56
56
|
@Component({
|
|
57
|
-
props: ['value', 'validator', 'type', {dense: true, outlined: true, focus: false}]
|
|
57
|
+
props: ['value', 'validator', 'type', 'day', {dense: true, outlined: true, focus: false}]
|
|
58
58
|
})
|
|
59
59
|
export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositionServiceMixin, CancelOnEscMixin) {
|
|
60
60
|
value_ = null
|
|
@@ -251,13 +251,22 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
|
251
251
|
: value.substr(4, 4))
|
|
252
252
|
value = `${day.padStart(2, '0')}.${month.padStart(2, '0')}.${year}`
|
|
253
253
|
} else {
|
|
254
|
-
//
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
const day =
|
|
258
|
-
const month =
|
|
259
|
-
const year =
|
|
254
|
+
// accept D.M. without year and expand to current year (covers inputs like '1.7.')
|
|
255
|
+
const mNoYear = value.match(/^(\d{1,2})\.(\d{1,2})\.$/)
|
|
256
|
+
if (mNoYear) {
|
|
257
|
+
const day = mNoYear[1].padStart(2, '0')
|
|
258
|
+
const month = mNoYear[2].padStart(2, '0')
|
|
259
|
+
const year = new Date().getFullYear().toString()
|
|
260
260
|
value = `${day}.${month}.${year}`
|
|
261
|
+
} else {
|
|
262
|
+
// also accept DD.MM.YY and expand to YYYY (covers inputs like '1.2.20')
|
|
263
|
+
const m = value.match(/^(\d{1,2})\.(\d{1,2})\.(\d{2})$/)
|
|
264
|
+
if (m) {
|
|
265
|
+
const day = m[1].padStart(2, '0')
|
|
266
|
+
const month = m[2].padStart(2, '0')
|
|
267
|
+
const year = (2000 + parseInt(m[3], 10)).toString()
|
|
268
|
+
value = `${day}.${month}.${year}`
|
|
269
|
+
}
|
|
261
270
|
}
|
|
262
271
|
}
|
|
263
272
|
|
|
@@ -310,7 +319,7 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
|
310
319
|
return this.actualInputValue
|
|
311
320
|
}
|
|
312
321
|
|
|
313
|
-
return formatDate(this.value_, {day:
|
|
322
|
+
return formatDate(this.value_, {day: this.day})
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
validate () {
|