add counter

This commit is contained in:
Hope87
2021-06-22 18:00:52 +03:00
parent 169ffedb01
commit 6a045534f1
10 changed files with 288 additions and 22 deletions

View File

@ -5,7 +5,7 @@ import rectangle from '../../images/rectangle__calendar.png';
import calendarIcon from '../../images/calendar_icon.png';
import moment from 'moment';
import 'moment/locale/ru';
import calendarHelper from './calendarHelper';
import { calendarHelper, currentMonthAndDay } from './calendarHelper';
const CalendarComponent = () => {
const [value, setValue] = useState(moment());
@ -30,10 +30,6 @@ const CalendarComponent = () => {
return '';
}
function currentMonth(day) {
return day.format('D MMMM');
}
function prevMonth() {
return value.clone().subtract(1, 'month');
}
@ -82,7 +78,7 @@ const CalendarComponent = () => {
id="btn"
>
<img className={style.calendarIcon} src={calendarIcon} alt="" />
{currentMonth(day)}
{currentMonthAndDay()}
</button>
))
)}