Conversation
src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue
Outdated
Show resolved
Hide resolved
src/coalesce-vue-vuetify3/src/components/input/c-time-picker.vue
Outdated
Show resolved
Hide resolved
src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue
Outdated
Show resolved
Hide resolved
src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue
Outdated
Show resolved
Hide resolved
src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue
Outdated
Show resolved
Hide resolved
src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue
Outdated
Show resolved
Hide resolved
src/coalesce-vue-vuetify3/src/components/input/c-time-picker.vue
Outdated
Show resolved
Hide resolved
|
|
…er.vue Co-authored-by: Andrew Scott <andrew.scott@intellitect.com>
…vatt/next/today-btn
src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue
Outdated
Show resolved
Hide resolved
| v-bind="datePickerProps" | ||
| > | ||
| <template v-slot:actions v-if="showTodayButton"> | ||
| <v-btn @click="setToday" :disabled="!isDateAllowed(new Date())"> Today </v-btn> |
There was a problem hiding this comment.
Checking if today's date is allowed... is just passing 'new Date()' here sufficient? Is there any worry about time zones?
There was a problem hiding this comment.
It would certainly be easier to not do this. Leave it up to the developer to just not enable the "Today" button if they know for their use case that selecting today will be out of bounds of their validation rules.
This validation is happening before the timezone transformations has been applied, so yes, there will be timezone issues here. The other usage of isDateAllowed in emitInput occurs after timezone transformations.
| <v-text-field | ||
| v-else | ||
| class="c-datetime-picker" | ||
| :class="{ 'today-btn': showTodayButton }" |
There was a problem hiding this comment.
This is an unusual class name. The entire component is not a today-btn. Only the button itself inside the component's menu would make sense to have a today-btn class.
Consider a more appropriate class name like c-datetime-picker__menu--has-today-btn on the menu's contentClass, which also adheres to the (mildly consistent) use of BEM selectors in this project.
3f3c313 to
ae5e482
Compare
| } | ||
| } | ||
|
|
||
| function isDateAllowed(date: Date) { |
There was a problem hiding this comment.
Maybe this should just be axed and if you click 'today' when there is a min/max value and today doesn't fall within it we just clamp to be within the bounds?
f14ec98 to
7375921
Compare
Description
Questions:
Ensure that your pull request has followed all the steps below: