@@ -142,7 +142,7 @@ picked time zone, but you will have to convert it yourself when necessary.
142142 <NcDateTimePicker
143143 v-model="time"
144144 type="datetime"
145- : show-timezone-select="true"
145+ show-timezone-select
146146 v-model:timezone-id="tz" /><br>
147147 {{ time }} | {{ tz }}
148148 </span>
@@ -184,20 +184,30 @@ import NcIconSvgWrapper from '../NcIconSvgWrapper/NcIconSvgWrapper.vue'
184184import NcTimezonePicker from ' ../NcTimezonePicker/NcTimezonePicker.vue'
185185
186186const props = withDefaults (defineProps <{
187+ /**
188+ * If set to true the menu will be placed on the `<body>`
189+ * instead of default placement on the picker.
190+ */
191+ appendToBody? : boolean
192+
187193 /**
188194 * Aria label for the input box.
195+ *
189196 * @default ' Datepicker input'
190197 */
191198 ariaLabel? : string
192199
193200 /**
194201 * Aria label for the date picker menu.
202+ *
195203 * @default ' Datepicker menu'
196204 */
197205 ariaLabelMenu? : string
198206
199207 /**
200208 * Allow to clear the input.
209+ *
210+ * @default false
201211 */
202212 clearable? : boolean
203213
@@ -207,26 +217,28 @@ const props = withDefaults(defineProps<{
207217 */
208218 confirm? : boolean
209219
210- /**
211- * Default increment step for minutes in the time picker.
212- * @default 10
213- */
214- minuteStep? : number
215-
216220 /**
217221 * Preview format for the picker input field.
222+ * Can either be a string of Unicode tokens or a function that takes a Date object
223+ * or for range picker an array of two dates, and returns the formatted date as string.
218224 *
219225 * @default Intl.DateTimeFormat is used to format dates and times
220226 * @see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
221227 */
222- format? : string
228+ format? : string | (( date : Date ) => string ) | (( dates : [ Date , Date ]) => string )
223229
224230 /**
225231 * The locale to use for formatting the shown dates.
226232 * By default the users current Nextcloud locale is used.
227233 */
228234 locale? : string
229235
236+ /**
237+ * Default increment step for minutes in the time picker.
238+ * @default 10
239+ */
240+ minuteStep? : number
241+
230242 /**
231243 * The value to initialize, but also two-way bind the selected date. The date is – like the `Date` object in
232244 * JavaScript – tied to UTC. The selected time zone does not have an influence of the selected time and date
@@ -241,19 +253,29 @@ const props = withDefaults(defineProps<{
241253 */
242254 placeholder? : string
243255
256+ /**
257+ * Include a timezone picker within the menu.
258+ * Please note that the dates are still bound to the locale timezone
259+ * and any conversion needs to be done by the app itself.
260+ *
261+ * @default false
262+ */
244263 showTimezoneSelect? : boolean
245264
265+ /**
266+ * Show the ISO week numbers within the calendar.
267+ *
268+ * @default false
269+ */
270+ showWeekNumber? : boolean
271+
246272 /**
247273 * Type of the picker.
248274 * The 'range' type will enable a range picker for dates,
249275 * while 'range-datetime' will allow picking a date range with times.
250276 * @default ' date'
251277 */
252278 type? : ' date' | ' datetime' | ' time' | ' week' | ' month' | ' year' | ' range' | ' range-datetime'
253-
254- appendToBody? : boolean
255-
256- showWeekNumber? : boolean
257279}>(), {
258280 ariaLabel: t (' Datepicker input' ),
259281 ariaLabelMenu: t (' Datepicker menu' ),
@@ -286,6 +308,11 @@ const emit = defineEmits<{
286308 ' update:timezoneId' : [string ]
287309}>()
288310
311+ /**
312+ * Mapping of the model-value prop to the format expected by the library.
313+ * We do not directly pass the prop and adjust the interface to not transparently wrap the library.
314+ * This has show as beeing a pain in the past when we need to switch underlying libraries.
315+ */
289316const value = computed (() => {
290317 if (props .modelValue === undefined && props .clearable ) {
291318 return props .modelValue
0 commit comments