chart edited

This commit is contained in:
hamid zarghami
2025-12-24 15:18:21 +03:30
parent 7797f47a7e
commit 2fd013d282
8 changed files with 275 additions and 129 deletions
+8 -1
View File
@@ -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]);