Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with selected days #19

Closed
rodrigoetoh opened this issue Jun 7, 2018 · 1 comment
Closed

Issue with selected days #19

rodrigoetoh opened this issue Jun 7, 2018 · 1 comment

Comments

@rodrigoetoh
Copy link

rodrigoetoh commented Jun 7, 2018

Hello, how you doing?

I found a bug when using selected days, the issue is that you use time to keep track of selected days, but you use it's TIME, without reseting the hour of the date element, whereas you do reset it when checking whether it is a selected day or not. This causes some days to not being marked as selected when drawing the calendar.

I'm attaching some examples.

A fix to that would be reseting the hours when you get the visible dates at:

JsCalendar.prototype._getVisibleDates = function(date) {

	// ...

	// Set day to month's first
	day = new Date(first.getTime());
	day.setHours(0, 0, 0, 0);
	// This month's days
	do {
	// Add page on back of the list
	dates.push(new Date(day.getTime()));
	// Calculate next day
	day.setDate(day.getDate() + 1);
	day.setHours(0, 0, 0, 0);
	// Repeat until next month
	} while (day.getDate() !== 1);

	// ...

Best regards,
Etoh.

screenshot_6
screenshot_7
screenshot_8

@GramThanos
Copy link
Owner

GramThanos commented Jun 7, 2018

I am fine! Thanks! How are you?

Commit 4741bbd

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants