Skip to content
This repository has been archived by the owner. It is now read-only.

fix(monthView): generate correct new start date when dropping an event #588

wants to merge 1 commit into
base: master


None yet
3 participants
Copy link

rafaelgribe commented May 3, 2017

When dropping an event from one month to another in the month view, the new date start for the event is being generated incorrectly. This happens when an event is dragged to a month with more days than the original event month. For example: dragging an event in February to January 31. The new event start date would be set to January 3.

The problem is the way moment is being used to generate the new date. According to moment documentation:

Note: if you chain multiple actions to construct a date, you should start from a year, then a month, then a day etc. Otherwise you may get unexpected results, like when day=31 and current month has only 30 days (the same applies to native JavaScript Date manipulation), the returned date will be 1st of the following month.

Bad: moment().date(day).month(month).year(year)
Good: moment().year(year).month(month).date(day)


This comment has been minimized.

Copy link

codecov-io commented May 3, 2017

Codecov Report

Merging #588 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #588   +/-   ##
  Coverage   95.93%   95.93%           
  Files          26       26           
  Lines         714      714           
  Hits          685      685           
  Misses         29       29
Impacted Files Coverage Δ
src/directives/mwlCalendarMonth.js 94.59% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0a51b6...85969ff. Read the comment docs.


This comment has been minimized.

Copy link

mattlewis92 commented May 21, 2017

Sorry about the delay with this one, I couldn't merge it as it had the dist files in the PR, so I've manually made the change and released 0.29.1 with it included. Thanks for the contribution! 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.