From 2a0e8022c080cc7673dad280a666962b1fa38537 Mon Sep 17 00:00:00 2001 From: behnaz-deriv Date: Tue, 11 Jun 2024 17:51:20 +0800 Subject: [PATCH] chore: log2 --- .../pages/signup-affiliates/utils/_birth-picker.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/themes/gatsby-theme-deriv/src/pages/signup-affiliates/utils/_birth-picker.tsx b/themes/gatsby-theme-deriv/src/pages/signup-affiliates/utils/_birth-picker.tsx index a46b5a235b1..0c0cbc6e404 100644 --- a/themes/gatsby-theme-deriv/src/pages/signup-affiliates/utils/_birth-picker.tsx +++ b/themes/gatsby-theme-deriv/src/pages/signup-affiliates/utils/_birth-picker.tsx @@ -102,16 +102,14 @@ const BirthPickerWrapper = styled.div` const BirthPicker = ({ id, error, value, setFieldValue, label, label_color }: BirthPickerProps) => { const [is_date_field, selectDateField] = useState(false) - console.log(is_date_field, 'is_date'); - console.log(value, 'value'); - const subtractYears = (numOfYears, date = new Date()) => { date.setFullYear(date.getFullYear() - numOfYears) return date } const max_date = subtractYears(18) - const handleDateChange = (date) => { + const handleDateChange = (date,e) => { + console.log(e.target) console.log('==>', date) setFieldValue((prev) => ({ ...prev, date_birth: date })) } @@ -126,7 +124,12 @@ const BirthPicker = ({ id, error, value, setFieldValue, label, label_color }: Bi showLeadingZeros={false} calendarIcon={calendar icon} clearIcon={null} - onChange={handleDateChange} + onChange={(date) => { + console.log("selected date is:", date) + // const d = new Date(date).toLocaleDateString('fr-FR'); + // console.log(d); + // setDate(d); + }} /> {label}