chart edited
This commit is contained in:
@@ -28,8 +28,15 @@ const DatePickerComponent: FC<Props> = (props: Props) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (value) {
|
||||
const formattedDate = `${value.year}-${value.month.number}-${value.day}`;
|
||||
// تبدیل تاریخ شمسی به میلادی
|
||||
const gregorianDate = value.toDate();
|
||||
const year = gregorianDate.getFullYear();
|
||||
const month = String(gregorianDate.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(gregorianDate.getDate()).padStart(2, '0');
|
||||
const formattedDate = `${year}-${month}-${day}`;
|
||||
props.onChange(formattedDate);
|
||||
} else {
|
||||
props.onChange('');
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [value]);
|
||||
|
||||
Reference in New Issue
Block a user