calendar.visibleDates().monthDates.first?.date and calendar.visibleDates().monthDates.last?.date always coming with a -1 offset in didScrollToDateSegmentWith
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
* [x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).
## What did you do?
Im trying to get first and last date of the month when user scrolls. I'm using didScrollToDateSegmentWith delegate method.
```
func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo) {
if let startDate = calendar.visibleDates().monthDates.first?.date, let endDate = calendar.visibleDates().monthDates.last?.date {
getData(startDate: startDate, endDate: endDate)
}
}
```
## What did you expect to happen?
I expected to get startDate and endDate of the corresponding month.
Eg:
**After scrolling to March 2020**
startDate 2020-03-01, endDate 2020-03-31
**After scrolling to April 2020**
startDate 2020-04-01 endDate 2020-04-30
## What happened instead?
Instead I always get startDate and endDate with -1 offset.
**When I set debug points to see startDate and endDate after scrolling to March 2020**
startDate 2020-02-29, endDate 2020-03-30
**When I move to April 2020**
startDate 2020-03-31 endDate 2020-04-29
## Charts Environment
**Charts version/Branch/Commit Number:**
**Xcode version:** Version 11.4.1
**Swift version:** Swift 5
**Platform(s) running Charts:** iOS 13.4.1
**macOS version running Xcode:** 10.15.4
## Demo Project
ℹ Please link to or upload a project we can download that reproduces the issue.
Contributor guide
Assessment
This issue has not been assessed yet.