Skip to content

Commit 2e7a455

Browse files
RYGRITdanielroe
andauthored
fix: prevent trends date input from being disabled while typing (#1370)
Co-authored-by: Daniel Roe <daniel@roe.dev>
1 parent ac9e023 commit 2e7a455

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/components/Package/TrendsChart.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {
1616
WeeklyDataPoint,
1717
YearlyDataPoint,
1818
} from '~/types/chart'
19+
import { DATE_INPUT_MAX } from '~/utils/input'
1920
2021
const props = withDefaults(
2122
defineProps<{
@@ -1452,6 +1453,7 @@ watch(selectedMetric, value => {
14521453
v-if="showFacetSelector"
14531454
id="trends-metric-select"
14541455
v-model="selectedMetric"
1456+
:disabled="activeMetricState.pending"
14551457
:items="METRICS.map(m => ({ label: m.label, value: m.id }))"
14561458
:label="$t('package.trends.facet')"
14571459
/>
@@ -1485,8 +1487,8 @@ watch(selectedMetric, value => {
14851487
<InputBase
14861488
id="startDate"
14871489
v-model="startDate"
1488-
:disabled="activeMetricState.pending"
14891490
type="date"
1491+
:max="DATE_INPUT_MAX"
14901492
class="w-full min-w-0 bg-transparent ps-7"
14911493
size="medium"
14921494
/>
@@ -1505,8 +1507,8 @@ watch(selectedMetric, value => {
15051507
<InputBase
15061508
id="endDate"
15071509
v-model="endDate"
1508-
:disabled="activeMetricState.pending"
15091510
type="date"
1511+
:max="DATE_INPUT_MAX"
15101512
class="w-full min-w-0 bg-transparent ps-7"
15111513
size="medium"
15121514
/>

app/utils/input.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ export function isKeyWithoutModifiers(event: KeyboardEvent, key: string): boolea
2626
!event.shiftKey
2727
)
2828
}
29+
30+
export const DATE_INPUT_MAX = '9999-12-31'

0 commit comments

Comments
 (0)