diff --git a/src/lib/components/Time.svelte b/src/lib/components/Time.svelte index a4b3598..64de239 100644 --- a/src/lib/components/Time.svelte +++ b/src/lib/components/Time.svelte @@ -136,7 +136,7 @@ $: innerHours = positions(isMinuteView ? 180 : 120, 110, isMinuteView ? '00' : '12', isMinuteView, 12); /** - * + * * @param {number} value * @param {boolean} asMeridian */ @@ -197,7 +197,7 @@ return startDate.getHours() === innerDate.getHours() && startDate.getMinutes() > val; } return startDate.getHours() > val; - } + } if (endDate && endDate.getDate() === innerDate.getDate() && endDate.getMonth() === innerDate.getMonth() @@ -230,7 +230,7 @@ innerDate[setter](val); } else if (isMinuteView) { - // compute it out of x,y + // compute it out of x,y const rect = clockEl.getBoundingClientRect(); const clientX = e.clientX - rect.left; const clientY = e.clientY - rect.top; @@ -286,7 +286,7 @@ innerDate.setMinutes(degree); } innerDate = innerDate; - + // handle only final click, not mouse move if (!handleMoveMove) { dispatch(isMinuteView ? 'minute' : 'hour', { @@ -310,7 +310,8 @@ innerDate = innerDate; dispatch(isMinuteView ? 'minute' : 'hour', { value: innerDate, - isKeyboard: e.type === 'keyboard' + // isKeyboard: e.type === 'keyboard' + isKeyboard: true }); } @@ -330,31 +331,38 @@
-
{#if hasDateComponent} {/if} + {#if !hourOnly} - {#if !hourOnly} : + {:else} + {view(selectedHour, showMeridian)} + {#if showMeridian} + {(isPM ? i18n.meridiem[1] : i18n.meridiem[0]).toUpperCase()} + {:else} + : + 00 + {/if} {/if} {#if showMeridian}
- +
{/if}
- +
{ handleMoveMove && onClick(e) }} on:mouseup={onToggleMove} bind:this={clockEl}> @@ -396,6 +404,10 @@ .sdt-time-figure { font-size: 1.5em; font-weight: bold; + padding: 0 0.375em; +} +.sdt-time-figure + .sdt-time-figure { + margin-left: -12px; } .sdt-clock { margin: auto; @@ -439,7 +451,7 @@ .sdt-meridian { position: absolute; top: 0; - right: 40px; + right: 0; display: flex; } .sdt-meridian .sdt-time-btn {