Skip to content

Commit

Permalink
Merge pull request #4610 from nextcloud-libraries/fix/empty-datetime-…
Browse files Browse the repository at this point in the history
…picker-native-stable7
  • Loading branch information
raimund-schluessler authored Oct 5, 2023
2 parents 99875ab + c15fee1 commit 1b10b1c
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/components/NcDateTimePickerNative/NcDateTimePickerNative.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- @copyright Copyright (c) 2022 Julia Kirschenheuter <julia.kirschenheuter@nextcloud.com>
-
- @author Julia Kirschenheuter <[email protected]>
- @author Richard Steinmetz <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand Down Expand Up @@ -33,13 +34,14 @@ All available types are: 'date', 'datetime-local', 'month', 'time' and 'week', p
#### Usage: type='datetime-local'
```vue
<template>
<span>
<div>
<span>Picked date: {{ value || 'null' }}</span>
<NcDateTimePickerNative
v-model="value"
:id="id"
:label="label"
type="datetime-local" />
</span>
</div>
</template>
<script>
export default {
Expand All @@ -57,15 +59,16 @@ All available types are: 'date', 'datetime-local', 'month', 'time' and 'week', p
#### Usage: type='datetime-local' with min date and max date
```vue
<template>
<span>
<div>
<span>Picked date: {{ value || 'null' }}</span>
<NcDateTimePickerNative
v-model="value"
:id="id"
:min="yesterdayDate"
:max="someDate"
:label="label"
type="datetime-local" />
</span>
</div>
</template>

<script>
Expand All @@ -86,13 +89,14 @@ All available types are: 'date', 'datetime-local', 'month', 'time' and 'week', p
#### Usage: type='week'
```vue
<template>
<span>
<div>
<span>Picked date: {{ value || 'null' }}</span>
<NcDateTimePickerNative
v-model="value"
:id="id"
:label="label"
type="week" />
</span>
</div>
</template>

<script>
Expand All @@ -111,13 +115,14 @@ All available types are: 'date', 'datetime-local', 'month', 'time' and 'week', p
#### Usage: type='month'
```vue
<template>
<span>
<div>
<span>Picked date: {{ value || 'null' }}</span>
<NcDateTimePickerNative
v-model="value"
:id="id"
:label="label"
type="month" />
</span>
</div>
</template>

<script>
Expand Down Expand Up @@ -163,10 +168,11 @@ export default {
* The date is – like the `Date` object in JavaScript – tied to UTC.
* The selected time zone does not have an influence of the selected time and date value.
* You have to translate the time yourself when you want to factor in time zones.
* Pass null to clear the input field.
*/
value: {
type: Date,
required: true,
default: null,
},

/**
Expand Down Expand Up @@ -265,7 +271,7 @@ export default {
*
* @return {string} empty string
*/
return this.$emit('input', '')
return this.$emit('input', null)
}
if (this.type === 'time') {
const time = $event.target.value
Expand Down

0 comments on commit 1b10b1c

Please sign in to comment.