Skip to content

Commit b723408

Browse files
authored
Merge pull request #3202 from nextcloud/fix/NcDatetimePicker_placeholder
Fix overwriting placeholder property in NcDatetimePicker
2 parents c162fe1 + dae7c21 commit b723408

2 files changed

Lines changed: 32 additions & 11 deletions

File tree

l10n/messages.pot

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,24 @@ msgstr ""
122122
msgid "People & Body"
123123
msgstr ""
124124

125+
msgid "Pick a date"
126+
msgstr ""
127+
128+
msgid "Pick a date and a time"
129+
msgstr ""
130+
131+
msgid "Pick a month"
132+
msgstr ""
133+
134+
msgid "Pick a time"
135+
msgstr ""
136+
137+
msgid "Pick a week"
138+
msgstr ""
139+
140+
msgid "Pick a year"
141+
msgstr ""
142+
125143
msgid "Pick an emoji"
126144
msgstr ""
127145

src/components/NcDatetimePicker/NcDatetimePicker.vue

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default {
130130
:formatter="formatter"
131131
:lang="lang"
132132
:minute-step="minuteStep"
133-
:placeholder="placeholder"
133+
:placeholder="placeholder ? placeholder : defaultPlaceholder"
134134
:popup-class="{ 'show-week-number': showWeekNumber }"
135135
:show-week-number="showWeekNumber"
136136
:type="type"
@@ -168,7 +168,7 @@ export default {
168168
<script>
169169
import NcTimezonePicker from '../NcTimezonePicker/index.js'
170170
import NcPopover from '../NcPopover/index.js'
171-
import l10n from '../../mixins/l10n.js'
171+
import { t } from '../../l10n.js'
172172
173173
import {
174174
getFirstDay,
@@ -199,8 +199,6 @@ export default {
199199
NcTimezonePicker,
200200
},
201201
202-
mixins: [l10n],
203-
204202
inheritAttrs: false,
205203
206204
props: {
@@ -266,6 +264,11 @@ export default {
266264
type: Boolean,
267265
default: false,
268266
},
267+
268+
placeholder: {
269+
type: String,
270+
default: null,
271+
},
269272
},
270273
271274
emits: [
@@ -307,23 +310,23 @@ export default {
307310
*
308311
* @return {string}
309312
*/
310-
placeholder() {
313+
defaultPlaceholder() {
311314
if (this.type === 'time') {
312-
return this.t('Pick a time')
315+
return t('Pick a time')
313316
}
314317
if (this.type === 'month') {
315-
return this.t('Pick a month')
318+
return t('Pick a month')
316319
}
317320
if (this.type === 'year') {
318-
return this.t('Pick a year')
321+
return t('Pick a year')
319322
}
320323
if (this.type === 'week') {
321-
return this.t('Pick a week')
324+
return t('Pick a week')
322325
}
323326
if (this.type === 'date') {
324-
return this.t('Pick a date')
327+
return t('Pick a date')
325328
}
326-
return this.t('Pick a date and a time')
329+
return t('Pick a date and a time')
327330
},
328331
329332
/**

0 commit comments

Comments
 (0)