Skip to content

Commit 0055699

Browse files
fix: Error prop not overriding for date-picker (#402)
* fix: Error prop not overriding for date-picker * fix: Error prop not overriding for date-picker --------- Co-authored-by: Gaurav Singh <gaurav3017@gmail.com>
1 parent b2f70bc commit 0055699

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/raystack/v1/components/calendar/date-picker.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,18 @@ export function DatePicker({
161161

162162
const defaultTrigger = (
163163
<InputField
164-
ref={inputFieldRef}
165164
size="small"
166165
placeholder="Select date"
166+
error={error}
167+
className={styles.datePickerInput}
167168
trailingIcon={showCalendarIcon ? <CalendarIcon /> : undefined}
169+
{...inputFieldProps}
170+
ref={inputFieldRef}
168171
defaultValue={formattedDate}
169172
onChange={handleInputChange}
170173
onFocus={handleInputFocus}
171174
onBlur={handleInputBlur}
172-
error={error}
173175
onKeyUp={handleKeyUp}
174-
className={styles.datePickerInput}
175-
{...inputFieldProps}
176176
/>
177177
);
178178

packages/raystack/v1/components/calendar/range-picker.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ export function RangePicker({
5959
? dayjs(selectedRange.to).format(dateFormat)
6060
: "";
6161

62-
// Ensures two months are visible even when
62+
// Ensures two months are visible even when
6363
// current month is the last allowed month (endMonth).
6464
const computedDefaultMonth = useMemo(() => {
6565
let month = currentMonth;
6666
if (calendarProps?.endMonth) {
6767
const endMonth = dayjs(calendarProps.endMonth);
6868
const fromMonth = dayjs(currentMonth);
69-
69+
7070
if (fromMonth.isSame(endMonth, 'month')) {
7171
month = endMonth.subtract(1, 'month').toDate();
7272
}
@@ -127,19 +127,19 @@ export function RangePicker({
127127
size='small'
128128
placeholder="Select start date"
129129
trailingIcon={showCalendarIcon ? <CalendarIcon /> : undefined}
130+
className={styles.datePickerInput}
130131
{...(inputFieldsProps.startDate ?? {})}
131132
value={startDate}
132-
className={styles.datePickerInput}
133133
readOnly
134134
/>
135135

136136
<InputField
137137
size='small'
138138
placeholder="Select end date"
139139
trailingIcon={showCalendarIcon ? <CalendarIcon /> : undefined}
140+
className={styles.datePickerInput}
140141
{...(inputFieldsProps.endDate ?? {})}
141142
value={endDate}
142-
className={styles.datePickerInput}
143143
readOnly
144144
/>
145145
</Flex>

0 commit comments

Comments
 (0)