Skip to content

Commit 43c1d81

Browse files
fix: adjust to new datepicker api
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
1 parent caa4c52 commit 43c1d81

File tree

1 file changed

+8
-34
lines changed

1 file changed

+8
-34
lines changed

src/components/AppSidebar/DateTimePickerItem.vue

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,23 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
3636
{{ propertyString }}
3737
</span>
3838
<div v-if="editing" class="content__input">
39-
<NcDateTimePicker :value="newValue"
40-
:lang="lang"
41-
:format="dateFormat"
39+
<NcDateTimePicker :model-value="newValue"
4240
:clearable="false"
4341
:append-to-body="true"
4442
:show-week-number="true"
4543
type="date"
4644
:placeholder="t('tasks', 'Set date')"
4745
class="date"
48-
@change="setDate" />
46+
@update:model-value="setDate" />
4947
<NcDateTimePicker v-if="!allDay"
50-
:value="newValue"
51-
:lang="lang"
52-
:format="timeFormat"
48+
:model-value="newValue"
5349
:clearable="false"
5450
:append-to-body="true"
55-
:time-picker-options="timePickerOptions"
51+
:minute-step="30"
5652
type="time"
5753
:placeholder="t('tasks', 'Set time')"
5854
class="time"
59-
@change="setTime" />
55+
@update:model-value="setTime" />
6056
</div>
6157
</div>
6258
<div class="item__actions">
@@ -84,7 +80,6 @@ import editableItem from '../../mixins/editableItem.js'
8480
import { overdue } from '../../store/storeHelper.js'
8581
8682
import { translate as t } from '@nextcloud/l10n'
87-
import moment from '@nextcloud/moment'
8883
import NcDateTimePicker from '@nextcloud/vue/components/NcDateTimePicker'
8984
9085
export default {
@@ -123,24 +118,6 @@ export default {
123118
default: true,
124119
},
125120
},
126-
data() {
127-
return {
128-
lang: {
129-
formatLocale: {
130-
firstDayOfWeek: window.firstDay,
131-
},
132-
days: window.dayNamesShort, // provided by nextcloud
133-
months: window.monthNamesShort, // provided by nextcloud
134-
},
135-
dateFormat: moment.localeData().longDateFormat('L'),
136-
timeFormat: moment.localeData().longDateFormat('LT'),
137-
timePickerOptions: {
138-
start: '00:00',
139-
step: '00:30',
140-
end: '23:30',
141-
},
142-
}
143-
},
144121
computed: {
145122
isValid() {
146123
return this.date.isValid()
@@ -161,12 +138,8 @@ export default {
161138
checkOutsideClick($event) {
162139
/**
163140
* If the click originates from the datepicker, we do nothing.
164-
* Can be removed once https://github.com/nextcloud/nextcloud-vue/pull/1881
165-
* is merged and the datepicker is not attached to body anymore.
166141
*/
167-
if ($event.target.closest('.mx-datepicker-main')
168-
|| $event.target.closest('.mx-table')
169-
|| $event.target.classList.contains('mx-btn')) {
142+
if ($event.target.closest('.dp__outer_menu_wrap')) {
170143
return
171144
}
172145
this.setValue()
@@ -254,8 +227,9 @@ $blue: #4271a6;
254227
display: flex;
255228
flex-grow: 1;
256229
flex-wrap: wrap;
230+
grid-gap: var(--default-grid-baseline);
257231
258-
.mx-datepicker {
232+
.dp__main {
259233
width: auto;
260234
&.date {
261235
min-width: 100px;

0 commit comments

Comments
 (0)