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

document source of pageIndex #448

Open
bsutton opened this issue Jan 5, 2025 · 0 comments
Open

document source of pageIndex #448

bsutton opened this issue Jan 5, 2025 · 0 comments

Comments

@bsutton
Copy link
Contributor

bsutton commented Jan 5, 2025

The views use a page controller allowing methods like JumpToPage to move the view to a specific page.

The issue is that, how the pageIndex is related to a date isn't documented.

In digging through the code the index is based on the minDay argument (which is actually a date and perhaps poorly named).

If minDay isn't passed the the epocDate is used (1900/1/1).

Then the index is calculated as the numbers of days since minDay.

The maths is different for a month and week with and alignment operation occuring (to the first day of the month or week).

So the maths is actually slightly non-trivial and it must be right or things go awry.

The result is that the likes of jumpToPage is impossible to use without this documentation.

The maths is complicated enough that I think we should expose a method to translate between the index/date and back.

For reference I'm creating a single page that allows a user to move between views (day, week, month) and the 'current' date needs to be retained as the users swaps.
As the pageIndex is different for a given date I need to translate between page indexes on the different views so knowing how it is calculated is critical to a correct implementation.

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

No branches or pull requests

1 participant