2021-06-22 18:00:52 +03:00
|
|
|
import moment from 'moment';
|
|
|
|
import 'moment/locale/ru';
|
|
|
|
|
|
|
|
export function calendarHelper(value) {
|
2021-06-17 18:21:48 +03:00
|
|
|
const startDay = value.clone().startOf('month').startOf('week').startOf('day');
|
|
|
|
const endDay = value.clone().endOf('month').endOf('week');
|
|
|
|
|
|
|
|
const day = startDay.clone().subtract(1, 'day');
|
|
|
|
|
|
|
|
const calendar = [];
|
|
|
|
|
|
|
|
while (day.isBefore(endDay, 'day')) {
|
|
|
|
calendar.push(
|
2021-06-18 17:16:08 +03:00
|
|
|
Array(1)
|
2021-06-17 18:21:48 +03:00
|
|
|
.fill(0)
|
|
|
|
.map(() => day.add(1, 'day').clone())
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return calendar;
|
|
|
|
}
|
2021-06-22 18:00:52 +03:00
|
|
|
|
|
|
|
export function currentMonth() {
|
|
|
|
const currentMonth = moment().format('MMMM');
|
|
|
|
|
|
|
|
return currentMonth.charAt(0).toUpperCase() + currentMonth.slice(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// export function currentMonthAndDay(day) {
|
|
|
|
// return day.format('D MMMM');
|
|
|
|
// }
|
|
|
|
|
|
|
|
export function currentMonthAndDay() {
|
|
|
|
return moment().format('D MMMM');
|
|
|
|
}
|