From 736020392b85d9090fb06c9ae59ba53a8979361f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 10 Dec 2020 12:16:35 +0100 Subject: [PATCH] Use direct datetime picker from Buefy Closes #494 Closes #459 Closes #207 Signed-off-by: Thomas Citharel --- js/src/components/Event/DateTimePicker.vue | 147 --------------------- js/src/views/Event/Edit.vue | 53 +++++--- 2 files changed, 38 insertions(+), 162 deletions(-) delete mode 100644 js/src/components/Event/DateTimePicker.vue diff --git a/js/src/components/Event/DateTimePicker.vue b/js/src/components/Event/DateTimePicker.vue deleted file mode 100644 index 2f18f06bf..000000000 --- a/js/src/components/Event/DateTimePicker.vue +++ /dev/null @@ -1,147 +0,0 @@ - -### Datetime Picker - -> We're wrapping the Buefy datepicker & an input - -### Defaults -- step: 10 - -### Example -```vue - -``` - - - - - diff --git a/js/src/views/Event/Edit.vue b/js/src/views/Event/Edit.vue index ddbe02510..cacb3a1d3 100644 --- a/js/src/views/Event/Edit.vue +++ b/js/src/views/Event/Edit.vue @@ -31,12 +31,31 @@ - - + + + + + + + + + + {{ $t("Date parameters") }} @@ -367,6 +386,10 @@ section { padding: 2rem 1.5rem; } + .begins-on-field { + margin-top: 22px; + } + nav.navbar { min-height: 2rem !important; background: lighten($secondary, 10%); @@ -394,7 +417,6 @@ import { Component, Prop, Vue, Watch } from "vue-property-decorator"; import { RefetchQueryDescription } from "apollo-client/core/watchQueryOptions"; import PictureUpload from "@/components/PictureUpload.vue"; import EditorComponent from "@/components/Editor.vue"; -import DateTimePicker from "@/components/Event/DateTimePicker.vue"; import TagInput from "@/components/Event/TagInput.vue"; import FullAddressAutoComplete from "@/components/Event/FullAddressAutoComplete.vue"; import IdentityPickerWrapper from "@/views/Account/IdentityPickerWrapper.vue"; @@ -443,7 +465,6 @@ const DEFAULT_LIMIT_NUMBER_OF_PLACES = 10; IdentityPickerWrapper, FullAddressAutoComplete, TagInput, - DateTimePicker, PictureUpload, Editor: EditorComponent, }, @@ -532,14 +553,16 @@ export default class EditEvent extends Vue { } private initializeEvent() { - // TODO : Check me - // const roundUpTo = (roundTo) => (x: number) => new Date(Math.ceil(x / roundTo) * roundTo); - // const roundUpTo15Minutes = roundUpTo(1000 * 60 * 15); + const roundUpTo15Minutes = (time: Date) => { + time.setMilliseconds(Math.round(time.getMilliseconds() / 1000) * 1000); + time.setSeconds(Math.round(time.getSeconds() / 60) * 60); + time.setMinutes(Math.round(time.getMinutes() / 15) * 15); + return time; + }; + + const now = roundUpTo15Minutes(new Date()); + const end = new Date(now.valueOf()); - // const now = roundUpTo15Minutes(new Date()); - // const end = roundUpTo15Minutes(new Date()); - const now = new Date(); - const end = new Date(); end.setUTCHours(now.getUTCHours() + 3); this.event.beginsOn = now;