Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Next arrow fixes #8

Merged
merged 5 commits into from
Jan 13, 2016
Merged

Next arrow fixes #8

merged 5 commits into from
Jan 13, 2016

Conversation

berrberr
Copy link
Contributor

Problem: If the max date is within the bottom two "rows" of the calendar (in day/week view) & inside the next month then the next month arrow is hidden.

The dates are still selectable, but are greyed out which is pretty confusing. This change will show the next arrow when at least 1 date is valid in the next month.

Alex Gabriel added 2 commits January 8, 2016 13:21
… in next

period. This happens when the max date is in the bottom "row" of the calendar
in day/week view.
else if @period() == 'year'
@firstYearOfDecade(currentDate).add(10, 'year')

{'arrow-hidden': !@currentDate.isWithinBoundaries(nextPeriodDate)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be simplified significantly. Year, Quarter & Month work fine as is. So we can just default to the old implementation in those cases:

date = @firstDate().clone().add(cols * rows, @period())

for day & week, however, we should be looking at the beginning of the month rather than whatever .add(cols * rows, @period() gives us.
So, I think something like this should work:

nextArrowCss: ->
  [cols, rows] = @period.dimentions()
  date = @firstDate().clone().add(cols * rows, @period())
  date = date.startOf('month') if @period() in ['day', 'week']
  {'arrow-hidden': !@currentDate.isWithinBoundaries(date)}

petethepig added a commit that referenced this pull request Jan 13, 2016
@petethepig petethepig merged commit bcc7e32 into master Jan 13, 2016
@petethepig petethepig deleted the next-arrow-fixes branch January 13, 2016 16:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants