Added CDate component !

This commit is contained in:
Paolo Arena
2019-04-05 16:16:29 +02:00
parent fe600f40a6
commit 7a55fa7f68
26 changed files with 421 additions and 40910 deletions

View File

@@ -1,39 +1,58 @@
import Vue from 'vue'
import { Component, Emit, Inject, Model, Prop, Provide } from 'vue-property-decorator'
import { Component, Prop, Watch } from 'vue-property-decorator'
import { tools } from '@src/store/Modules/tools'
import * as moment from 'moment'
import { date } from 'quasar'
@Component({
name: 'CDate'
})
export default class CDate extends Vue {
// ************* IS NOT WORKING WELL ! ************
// @Model('input', {
// default: ''
// })
// public mydate!: Date
@Prop() public myhint: string
@Model('input', {
default: '1999/01/01'
})
public mydate!: string
@Prop() public mydate!: Date
@Prop({ required: false }) public label: string
@Prop({ required: false, default: '' }) public data_class!: string
private valueInternal: string = '1988/01/01'
public mystyleicon: string = 'font-size: 1.5rem;'
@Emit('input')
public onValueChanged(value: string) {
@Watch('mydate')
public valchanged(value) {
this.valueInternal = value
}
// get getmydate() {
// console.log('getmydate', this.mydate)
// return tools.getstrDate(this.mydate)
// }
//
// public updatedate(mydate) {
// console.log('updatedate', mydate)
// this.mydate = mydate
// }
public $refs: {
datePicker
}
private valueInternal: Date = tools.getDateNull()
public created() {
this.valueInternal = this.mydate
if (this.data_class !== '') {
this.mystyleicon = 'font-size: 1rem;'
}
}
public changedate(value) {
const datavalida = tools.convertstrtoDate(value)
if (!!datavalida) {
this.valueInternal = datavalida
console.log('EMIT: changedate', datavalida)
this.$emit('input', this.getDate())
} else {
console.log(' DATA NON VALIDAAAAAAAAAAAAA ', value, datavalida)
}
this.$refs.datePicker.hide()
}
get getdatestring() {
return tools.getstrDate(this.valueInternal)
}
get getdateyymmddstring() {
return tools.getstrYYMMDDDate(this.valueInternal)
}
private getDate() {
return this.valueInternal
}
}