Skip to content

Commit 3b3d1a6

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

File tree

1 file changed

+8
-33
lines changed

1 file changed

+8
-33
lines changed

src/components/AppSidebar/DateTimePickerItem.vue

Lines changed: 8 additions & 33 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 :modelValue="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:modelValue="setDate" />
4947
<NcDateTimePicker v-if="!allDay"
50-
:value="newValue"
51-
:lang="lang"
52-
:format="timeFormat"
48+
:modelValue="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:modelValue="setTime" />
6056
</div>
6157
</div>
6258
<div class="item__actions">
@@ -123,24 +119,6 @@ export default {
123119
default: true,
124120
},
125121
},
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-
},
144122
computed: {
145123
isValid() {
146124
return this.date.isValid()
@@ -161,12 +139,8 @@ export default {
161139
checkOutsideClick($event) {
162140
/**
163141
* 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.
166142
*/
167-
if ($event.target.closest('.mx-datepicker-main')
168-
|| $event.target.closest('.mx-table')
169-
|| $event.target.classList.contains('mx-btn')) {
143+
if ($event.target.closest('.dp__outer_menu_wrap')) {
170144
return
171145
}
172146
this.setValue()
@@ -254,8 +228,9 @@ $blue: #4271a6;
254228
display: flex;
255229
flex-grow: 1;
256230
flex-wrap: wrap;
231+
grid-gap: var(--default-grid-baseline);
257232
258-
.mx-datepicker {
233+
.dp__main {
259234
width: auto;
260235
&.date {
261236
min-width: 100px;

0 commit comments

Comments
 (0)