about summary refs log tree commit diff
path: root/src/components/forms/DateField/index.web.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-02-03 12:27:58 -0800
committerGitHub <noreply@github.com>2025-02-03 20:27:58 +0000
commit23e62b18de9537b50c8b1df2b4744adc030501d0 (patch)
tree557037a964f2a8f7a3583ae84fc3b67b498c1ed2 /src/components/forms/DateField/index.web.tsx
parent25991af7224cd76a8722f0579c00b73a211a84cc (diff)
downloadvoidsky-23e62b18de9537b50c8b1df2b4744adc030501d0.tar.zst
Date input improvements (#7639)
* add max date, use modern field for birthday input

* rm legacy date input

* handle simplifying to simpleDateString internally

* update jsdoc
Diffstat (limited to 'src/components/forms/DateField/index.web.tsx')
-rw-r--r--src/components/forms/DateField/index.web.tsx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/forms/DateField/index.web.tsx b/src/components/forms/DateField/index.web.tsx
index b764620e3..057ea1673 100644
--- a/src/components/forms/DateField/index.web.tsx
+++ b/src/components/forms/DateField/index.web.tsx
@@ -1,6 +1,6 @@
 import React from 'react'
 import {StyleSheet, TextInput, TextInputProps} from 'react-native'
-// @ts-ignore
+// @ts-expect-error untyped
 import {unstable_createElement} from 'react-native-web'
 
 import {DateFieldProps} from '#/components/forms/DateField/types'
@@ -39,6 +39,7 @@ export function DateField({
   isInvalid,
   testID,
   accessibilityHint,
+  maximumDate,
 }: DateFieldProps) {
   const handleOnChange = React.useCallback(
     (e: any) => {
@@ -56,12 +57,14 @@ export function DateField({
     <TextField.Root isInvalid={isInvalid}>
       <TextField.Icon icon={CalendarDays} />
       <Input
-        value={value}
+        value={toSimpleDateString(value)}
         label={label}
         onChange={handleOnChange}
         onChangeText={() => {}}
         testID={testID}
         accessibilityHint={accessibilityHint}
+        // @ts-expect-error not typed as <input type="date"> even though it is one
+        max={maximumDate ? toSimpleDateString(maximumDate) : undefined}
       />
     </TextField.Root>
   )