Skip to content

Commit

Permalink
Adjust time formatting; Removing unneeded code; adjust styles
Browse files Browse the repository at this point in the history
  • Loading branch information
blalan05 committed Apr 27, 2024
1 parent be276cd commit 098f9dd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions packages/vuetify/src/composables/date/adapters/vuetify.ts
Expand Up @@ -333,13 +333,13 @@ function format (
options = { second: 'numeric' }
break
case 'fullTime':
options = { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }
options = { hour: 'numeric', minute: 'numeric', hour12: true }
break
case 'fullTime12h':
options = { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }
options = { hour: 'numeric', minute: 'numeric', hour12: true }
break
case 'fullTime24h':
options = { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: false }
options = { hour: 'numeric', minute: 'numeric', hour12: false }
break
case 'fullDateTime':
options = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }
Expand Down
17 changes: 5 additions & 12 deletions packages/vuetify/src/labs/VTimeInput/VTimeInput.tsx
Expand Up @@ -7,12 +7,11 @@ import { makeVTimePickerProps, VTimePicker } from '@/labs/VTimePicker/VTimePicke
// Composables
import { useDate } from '@/composables/date'
import { makeFocusProps, useFocus } from '@/composables/focus'
import { useLocale } from '@/composables/locale'
import { useProxiedModel } from '@/composables/proxiedModel'

// Utilities
import { computed, shallowRef } from 'vue'
import { genericComponent, omit, propsFactory, useRender, wrapInArray } from '@/util'
import { genericComponent, omit, propsFactory, useRender } from '@/util'

// Types
export interface VTimeInputSlots {
Expand All @@ -29,7 +28,6 @@ export const makeVTimeInputProps = propsFactory({
prependIcon: '$clock',
}),
...omit(makeVTimePickerProps({
weeksInMonth: 'dynamic' as const,
hideHeader: true,
}), ['active']),
}, 'VTimeInput')
Expand All @@ -44,19 +42,14 @@ export const VTimeInput = genericComponent()({
},

setup (props, { slots }) {
const { t } = useLocale()
const adapter = useDate()
const { isFocused, focus, blur } = useFocus(props)
const model = useProxiedModel(props, 'modelValue', props.multiple ? [] : null)
const model = useProxiedModel(props, 'modelValue', null)
const menu = shallowRef(false)

const display = computed(() => {
const value = wrapInArray(model.value)

if (!value.length) return null

return adapter.isValid(model.value) ? adapter.format(model.value, 'keyboardDate') : ''
})
const display = computed(() => adapter.isValid(model.value)
? adapter.format(model.value, props.format === '24hr' ? 'fullTime24h' : 'fullTime12h')
: '')

function onKeydown (e: KeyboardEvent) {
if (e.key !== 'Enter') return
Expand Down
3 changes: 3 additions & 0 deletions packages/vuetify/src/labs/VTimePicker/VTimePicker.sass
Expand Up @@ -9,3 +9,6 @@
.v-picker-title
padding: 0
margin-bottom: 20px

.v-picker__body
padding: 0
Expand Up @@ -15,7 +15,7 @@
color: rgb(var(--v-theme-on-surface-variant))

.v-time-picker-clock
margin: 0 auto
margin: 24px auto
background: rgb(var(--v-theme-surface-light))
border-radius: 50%
position: relative
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/labs/VTimePicker/_variables.scss
@@ -1,6 +1,6 @@
@forward '../VPicker/variables';

$time-picker-padding: 24px !default;
$time-picker-padding: 0px !default;
$time-picker-contols-btn-font: 56px !default;
$time-picker-contols-btn-height: 80px !default;
$time-picker-contols-btn-width: 96px !default;
Expand Down

0 comments on commit 098f9dd

Please sign in to comment.