refactor date and datetime types

This commit is contained in:
Simon Vieille 2020-08-05 16:16:23 +02:00
parent 49b2a64cee
commit cd596b2aad
Signed by: deblan
GPG key ID: 03383D15A1D31745
2 changed files with 65 additions and 2 deletions

View file

@ -20,17 +20,48 @@
-
-->
<template>
<Question
v-bind.sync="$attrs"
:text="text"
:mandatory="mandatory"
:edit.sync="edit"
:read-only="readOnly"
:max-question-length="maxStringLengths.questionText"
:title-placeholder="answerType.titlePlaceholder"
:warning-invalid="answerType.warningInvalid"
@update:text="onTitleChange"
@update:mandatory="onMandatoryChange"
@delete="onDelete">
<div v-if="readOnly" class="question__content">
<DatetimePicker
v-model="time" />
</div>
</Question>
</template>
<script>
import QuestionShort from './QuestionShort'
import DatetimePicker from '@nextcloud/vue/dist/Components/DatetimePicker'
export default {
name: 'QuestionDate',
components: {
DatetimePicker,
},
mixins: [QuestionShort],
data() {
return {
type: 'date',
time: null,
}
},
watch: {
time(value) {
this.$emit('update:values', [value])
}
},
}

View file

@ -20,17 +20,49 @@
-
-->
<template>
<Question
v-bind.sync="$attrs"
:text="text"
:mandatory="mandatory"
:edit.sync="edit"
:read-only="readOnly"
:max-question-length="maxStringLengths.questionText"
:title-placeholder="answerType.titlePlaceholder"
:warning-invalid="answerType.warningInvalid"
@update:text="onTitleChange"
@update:mandatory="onMandatoryChange"
@delete="onDelete">
<div v-if="readOnly" class="question__content">
<DatetimePicker
v-model="time"
type="datetime" />
</div>
</Question>
</template>
<script>
import QuestionShort from './QuestionShort'
import DatetimePicker from '@nextcloud/vue/dist/Components/DatetimePicker'
export default {
name: 'QuestionDatetime',
components: {
DatetimePicker,
},
mixins: [QuestionShort],
data() {
return {
type: 'datetime-local',
time: null,
}
},
watch: {
time(value) {
this.$emit('update:values', [value])
}
},
}