Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handling of empty values in NcDateTimePickerNative #4540

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
-
- @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
Loading