Open egadstar opened 8 years ago
+1 have the same issue on switching months
+1, seems to only happen when my physical tz and moment.tz default differ
calendar(firstOfWeek, firstOfMonth) {
const start = moment(firstOfMonth.startOf('month')).startOf('week');
const end = moment(firstOfMonth.endOf('month')).endOf('week');
const range = moment.range(
start,
end
);
const array = [];
let week = [];
range.by('day', (day) => {
week.push(day);
if (week.length === 7) {
array.push(week);
week = [];
}
});
return array;
},
render() {
let {firstOfWeek, firstOfMonth} = this.props;
let monthDates = Immutable.fromJS(this.calendar(firstOfWeek, firstOfMonth));
let weeks = monthDates.map(this.renderWeek);
I think this works and we can remove the dependency of 'calendar'
+1 also just hit this when changing months
This can be easily tested by including moment-timezone and setting the default timezone in the examples.
import momentTz from 'moment-timezone'; ... momentTz.tz.setDefault('America/Chicago'); // freeze date to April 1st timekeeper.freeze(new Date('2015-04-01')); ...
Basically, multiple issues occur:
1) Cannot toggle through months 2) The weekend styles are applied to Sunday and Monday 3) Lots of dates are not selectable within the min and max 4) Calendars displayed are one month behind 5) In certain cases, you are unable to select any dates.
Good example without moment-timezone
Broken examples with moment-timezone