|
|
|
@ -30,10 +30,10 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import VuePersianDatetimePicker from 'vue-persian-datetime-picker'
|
|
|
|
|
import moment from 'jalali-moment';
|
|
|
|
|
import VuePersianDatetimePicker from 'vue-persian-datetime-picker'
|
|
|
|
|
import {convertToJalali, convertNowToJalali} from '@Global/utils/date/jalali-date'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
datePicker: VuePersianDatetimePicker
|
|
|
|
|
},
|
|
|
|
@ -75,15 +75,14 @@ export default {
|
|
|
|
|
dateShow: {
|
|
|
|
|
get() {
|
|
|
|
|
if (this.value) {
|
|
|
|
|
return moment(new Date(this.value)).format(this.defaultDisplayFormat);
|
|
|
|
|
return convertToJalali(this.value, this.defaultDisplayFormat);
|
|
|
|
|
} else if (!this.disabled) {
|
|
|
|
|
if (this.defaultDate === 'now') {
|
|
|
|
|
this.$emit('input', moment(new Date()).format(this.defaultFormat));
|
|
|
|
|
return moment(new Date()).format(this.defaultDisplayFormat);
|
|
|
|
|
this.$emit('input', convertNowToJalali(null, this.defaultFormat));
|
|
|
|
|
return convertNowToJalali(null, this.defaultDisplayFormat);
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
set(value) {
|
|
|
|
@ -100,7 +99,8 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this.displayFormat
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
defaultInputFormat() {
|
|
|
|
|
if (!this.inputFormat) {
|
|
|
|
|
if (this.type === 'datetime') {
|
|
|
|
@ -112,7 +112,8 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this.inputFormat
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
defaultFormat() {
|
|
|
|
|
if (!this.format) {
|
|
|
|
|
if (this.type === 'datetime') {
|
|
|
|
@ -124,29 +125,34 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this.format
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
minimum() {
|
|
|
|
|
if (this.min === 'now') {
|
|
|
|
|
return moment(new Date()).format(this.defaultInputFormat);
|
|
|
|
|
return convertNowToJalali(null, this.defaultInputFormat);
|
|
|
|
|
} else {
|
|
|
|
|
return this.min;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
maximum() {
|
|
|
|
|
if (this.max === 'now') {
|
|
|
|
|
return moment(new Date()).format(this.defaultInputFormat);
|
|
|
|
|
return convertNowToJalali(null, this.defaultInputFormat);
|
|
|
|
|
} else {
|
|
|
|
|
return this.max;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
methods: {
|
|
|
|
|
changeDatePicker(event) {
|
|
|
|
|
if (!this.disabled) {
|
|
|
|
|
this.$emit('input', event.format(this.defaultFormat))
|
|
|
|
|
this.$emit('input', event.format(this.defaultFormat));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
watch: {
|
|
|
|
|
disabled(value) {
|
|
|
|
|
if (value) {
|
|
|
|
@ -154,5 +160,5 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|