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

Wrong selected NSDate #210

Closed
dbyst opened this issue Nov 24, 2016 · 7 comments
Closed

Wrong selected NSDate #210

dbyst opened this issue Nov 24, 2016 · 7 comments

Comments

@dbyst
Copy link

dbyst commented Nov 24, 2016

Hi guys . Thanks for a great calendar.

I've faced with issue that delegate returns me wrong date in

  • (void)didSelectDatesWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate {
    For example if 2016-11-17 selected, it returns 2016-11-16 22:00:00 +0000.

What might be a problem ?

Thanks.

@patchthecode
Copy link
Owner

Ok, first thing. What version of the calendar are you using?

the didSelectDate function looks like this

func calendar(_ calendar: JTAppleCalendarView, didSelectDate date: Date, cell: JTAppleDayCellView?, cellState: CellState)

@patchthecode patchthecode self-assigned this Nov 26, 2016
@haketputek
Copy link

I also have the same problem, I'm using version 5.0.1 (just because our project can't migrate to swift 3.0 yet). Can you please check where I can edit the library so we can get the correct date? And thanks for the great calendar!

@dbyst
Copy link
Author

dbyst commented Nov 29, 2016

I'm using 6.01. Application is on Objective C, so I created a bridge.

didSelectDate looks like this

  • (void)didSelectDatesWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate

@patchthecode
Copy link
Owner

patchthecode commented Nov 29, 2016

sounds like youre in an eastern region.
@dbyst ok, use the following as the calendar that you provide to the configureCalendar function as a workaround.

var calendar = Calendar.current
calendar.timeZone = TimeZone(secondsFromGMT: 0)

Let me look into fixing this. This happens if youre on the Eastern Hemisphere where your tiem zone is different. Working on a fix now.

@patchthecode
Copy link
Owner

patchthecode commented Nov 29, 2016

Can you try updating to version 6.0.3 and let me know if your issue was resolved?

@dbyst
Copy link
Author

dbyst commented Nov 29, 2016

Sure, will take a look, and let you know. Thanks.

@patchthecode
Copy link
Owner

Alright then. Closing this issue as it is fixed.
If this is still a problem. We can re-open this.

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

3 participants