2019-04-03 02:48:05 +02:00
|
|
|
import Vue from 'vue'
|
2019-04-05 16:16:29 +02:00
|
|
|
import { Component, Prop, Watch } from 'vue-property-decorator'
|
2019-04-03 02:48:05 +02:00
|
|
|
import { tools } from '@src/store/Modules/tools'
|
2019-04-05 16:16:29 +02:00
|
|
|
|
|
|
|
|
import { date } from 'quasar'
|
2019-04-03 02:48:05 +02:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
name: 'CDate'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default class CDate extends Vue {
|
2019-04-05 16:16:29 +02:00
|
|
|
@Prop() public mydate!: Date
|
|
|
|
|
@Prop({ required: false }) public label: string
|
|
|
|
|
@Prop({ required: false, default: '' }) public data_class!: string
|
|
|
|
|
|
|
|
|
|
public mystyleicon: string = 'font-size: 1.5rem;'
|
|
|
|
|
|
|
|
|
|
@Watch('mydate')
|
|
|
|
|
public valchanged(value) {
|
2019-04-03 02:48:05 +02:00
|
|
|
this.valueInternal = value
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-05 16:16:29 +02:00
|
|
|
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
|
|
|
|
|
}
|
2019-04-03 02:48:05 +02:00
|
|
|
|
|
|
|
|
}
|