-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4610 from nextcloud-libraries/fix/empty-datetime-…
…picker-native-stable7
- Loading branch information
Showing
1 changed file
with
16 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
- | ||
|
@@ -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 { | ||
|
@@ -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> | ||
|
@@ -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> | ||
|
@@ -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> | ||
|
@@ -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, | ||
}, | ||
|
||
/** | ||
|
@@ -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 | ||
|