Jtapplecalendar: Scrolling Calendar to latest date will show wrong dates

Created on 5 Jan 2018  ·  11Comments  ·  Source: patchthecode/JTAppleCalendar

try this
I made a programmatically calendar using the JTAppleCalendarView

use this as the configuration:
let startdate = formatter.date(from: "2017 02 01")!
let endDate = formatter.date(from: "2018 02 28")!

the in viewDidload, try to reload the calendar and it will show wrong dates in every cell

Awaiting User Input

Most helpful comment

Does it work now?
if it works then i can close this issue

All 11 comments

Im using 7.1.5 version of JTAppleCalendar

@siapno01 what do you mean wrong dates in every cell?

A screen shot can help.
Are the dates wrong by one date less?

the dates are wrong once you scrollToDate for 1 time only in view did
load..maybe later ai can give the screen shot

On Jan 5, 2018 5:04 PM, "JTAppleCalendar" notifications@github.com wrote:

@siapno01 https://github.com/siapno01 what do you mean wrong dates in
every cell?

A screen shot can help.
Are the dates wrong by one date less?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/patchthecode/JTAppleCalendar/issues/673#issuecomment-355505383,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AScWPvlVpsX57UMykvIzSdYv8AkEj7tWks5tHeWsgaJpZM4RUJwi
.

this what will show..

On Jan 5, 2018 6:00 PM, "Michael Siapno" siapno01@gmail.com wrote:

the dates are wrong once you scrollToDate for 1 time only in view did
load..maybe later ai can give the screen shot

On Jan 5, 2018 5:04 PM, "JTAppleCalendar" notifications@github.com
wrote:

@siapno01 https://github.com/siapno01 what do you mean wrong dates in
every cell?

A screen shot can help.
Are the dates wrong by one date less?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/patchthecode/JTAppleCalendar/issues/673#issuecomment-355505383,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AScWPvlVpsX57UMykvIzSdYv8AkEj7tWks5tHeWsgaJpZM4RUJwi
.

when I try to use the startdate and endDate value in tutorial it works
great but when I change the value as I comment above it is not working

On Jan 5, 2018 6:04 PM, "Michael Siapno" siapno01@gmail.com wrote:

this what will show..

On Jan 5, 2018 6:00 PM, "Michael Siapno" siapno01@gmail.com wrote:

the dates are wrong once you scrollToDate for 1 time only in view did
load..maybe later ai can give the screen shot

On Jan 5, 2018 5:04 PM, "JTAppleCalendar" notifications@github.com
wrote:

@siapno01 https://github.com/siapno01 what do you mean wrong dates in
every cell?

A screen shot can help.
Are the dates wrong by one date less?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/patchthecode/JTAppleCalendar/issues/673#issuecomment-355505383,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AScWPvlVpsX57UMykvIzSdYv8AkEj7tWks5tHeWsgaJpZM4RUJwi
.

I still do not understand.
You'll have to explain what you mean by it is wrong.
Please explain this to me in "programmer language".
Saying that something is wrong is not versy descriptive.

You'll have to tell me:

  1. what is expected
  2. what you did
  3. how your results differed from what you expected

only then i can know what "wrong" is.

Firs set the configure of calendar like this

func configureCalendar(_ calendar: JTAppleCalendarView) -> ConfigurationParameters {

        let startdate = formatter.date(from: "2017 02 01")
        let endDate = formatter.date(from: "2020 02 28")

        let parameters = ConfigurationParameters(startDate: startdate, endDate: endDate)
        return parameters
    }

then try to scroll to current date in viewDidLoad

override func viewDidLoad() {
        super.viewDidLoad()

        calendar.register(CalendarDayViewCell.self, forCellWithReuseIdentifier: CalendarDayViewCell.reuseIdentifier)

        calendar.calendarDelegate = self
        calendar.calendarDataSource = self
        calendar.scrollToDate(Date())
    }

This what will show and see the dates in every cell.

screen shot 2018-01-06 at 1 23 07 pm

When you scroll it .. It will be nice .. is that a bug or what ? I try to put calendar.reload() below the calendar.scrollToDate(Date()) but nothing happen.

*What I expect is to show the current date .

If you created your calendar manually, did you remember to put this in your code?

calendarView.scrollingMode = .stopAtEachCalendarFrame

If you created your calendar manually, you must put this in your code.
If you created your calendar using interface builder, then this should be done automatically for you.
let me know.

Im sorry i did not put that one.

On Jan 6, 2018 2:47 PM, "JTAppleCalendar" notifications@github.com wrote:

If you created your calendar manually, did you remember to put this in
your code?

calendarView.scrollingMode = .stopAtEachCalendarFrame


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/patchthecode/JTAppleCalendar/issues/673#issuecomment-355727944,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AScWPsHYtOFozbvVcvoM5aIX_LE0qpEhks5tHxcVgaJpZM4RUJwi
.

Does it work now?
if it works then i can close this issue

Yes it works good now . thanks a lot . I didnt notice that you need to declare that when you are creating calendar manually . This is noted . 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sahirmemon picture sahirmemon  ·  4Comments

VladFrolov picture VladFrolov  ·  4Comments

programus picture programus  ·  3Comments

Kevinw14 picture Kevinw14  ·  3Comments

Geekbell picture Geekbell  ·  4Comments