Go To Today Button made (has some issues)

Doesn't work when month is changed
master
Pedram Keshavarzi 3 years ago
parent f26f4c2003
commit 9e09b78215
  1. 1
      src/components/RangeDatePicker/index.js
  2. 9
      src/components/SimpleDatePicker/index.js

@ -10,6 +10,7 @@ const RangeDatePicker = () => {
return (
<DatePicker
value={selectedDayRange}
calendarClassName="range-date-picker"
onChange={setSelectedDayRange}
inputPlaceholder="یک بازه زمانی انتخاب کنید"
shouldHighlightWeekends

@ -1,8 +1,12 @@
import React, { useState } from 'react';
import DatePicker from "react-modern-calendar-datepicker";
import DatePicker, {utils} from "react-modern-calendar-datepicker";
import '../Calendar/index.css';
const SimpleDatePicker = () =>{
const SimpleDatePicker = (props) =>{
const [selectedDay, setSelectedDay] = useState(null);
const gotoToday = () =>{
setSelectedDay(utils('fa').getToday());
}
return(
<div className='flex items-center justify-center w-full my-2'>
<DatePicker
@ -10,6 +14,7 @@ const SimpleDatePicker = () =>{
onChange={setSelectedDay}
inputPlaceholder="انتخاب تاریخ"
shouldHighlightWeekends
renderFooter={() => <button onClick={gotoToday}>برو به امروز</button>}
locale='fa'
/>
</div>

Loading…
Cancel
Save