From a65977eebd75a59ce2a0df4ec677035c2e302027 Mon Sep 17 00:00:00 2001 From: Maik Hinrichs Date: Fri, 9 Oct 2020 23:59:52 +0200 Subject: [PATCH 1/3] ISO format, without time, without clear button --- README.md | 4 +- package.json | 6 +-- src/app.vue | 71 +++++++++++++++++++++++++++++++ src/components/DatetimePicker.vue | 33 +++++++++++--- 4 files changed, 104 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8b609a0..248e363 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,13 @@ Once installed, it can be used in a template as simply as: | dialogWidth | Number | 340 | The width of the dialog. | | dateFormat | string | yyyy-MM-dd | Defines the format of a date. | | timeFormat | string | HH:mm | Defines the format of a time. | -| clearText | string | CLEAR | Sets the text of the clear button. | +| clearText | string | CLEAR | Sets the text of the clear button. An empty string prevents the button from showing. | | okText | string | OK | Sets the text of the ok button. | | textFieldProps | Object | | Text fields properties. See [Vuetify Docs](https://vuetifyjs.com/en/components/text-fields 'Vuetify Docs') | | datePickerProps | Object | | Date pickers properties.See [Vuetify Docs](https://vuetifyjs.com/en/components/date-pickers 'Vuetify Docs') | | timePickerProps | Object | | Time pickers properties.See [Vuetify Docs](https://vuetifyjs.com/en/components/time-pickers 'Vuetify Docs') | +| useIso | Boolean | false | Use ISO format in datetime (model) and input event | +| withoutTime | Boolean | false | Pick a date without a time. | ## Events diff --git a/package.json b/package.json index 29abb24..7f462bd 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "webpack-merge": "^4.2.1" }, "dependencies": { - "date-fns": "^2.1.0", - "vue": "^2.6.10", - "vuetify": "^2.1.3" + "date-fns": "^2.16.1", + "vue": "^2.6.12", + "vuetify": "^2.3.13" } } diff --git a/src/app.vue b/src/app.vue index da8d998..8bc1ac5 100644 --- a/src/app.vue +++ b/src/app.vue @@ -30,6 +30,26 @@ + + Init with Date without Time + + + + +
Date value:
+
+
+ + + Init with Date without Clear Button + + + + +
Datetime value:
+
+
+ Init with String @@ -40,6 +60,16 @@ + + Init with String without Time + + + + +
Datetime value:
+
+
+ Loading @@ -145,6 +175,36 @@
Datetime value:
+ + + Custom Format: ISO + + + + +
Datetime value:
+
+
+ + + Custom Property and Format: German date and time format, ISO + + + + +
Datetime value:
+
+
+ @@ -159,7 +219,10 @@ export default { return { nullDatetime: null, datetime: new Date(), + dateWithoutTime: new Date(), datetimeString: '2019-01-01 12:00', + datetimeStringISO: '2019-01-01T11:00:00.000Z', + dateStringWithoutTime: '2019-01-01', formattedDatetime: '09/01/2019 12:00', textFieldProps: { appendIcon: 'event' @@ -170,6 +233,14 @@ export default { timeProps: { useSeconds: true, ampmInTitle: true + }, + datePropsDe: { + locale: 'de-de', + firstDayOfWeek: 1 + }, + timePropsDe: { + locale: 'de-de', + format: '24hr' } } } diff --git a/src/components/DatetimePicker.vue b/src/components/DatetimePicker.vue index 71feba8..ff83858 100644 --- a/src/components/DatetimePicker.vue +++ b/src/components/DatetimePicker.vue @@ -20,7 +20,7 @@ - + event @@ -44,11 +44,18 @@ > + - {{ clearText }} + {{ clearText }} {{ okText }} @@ -57,7 +64,7 @@