Skip to content

document source of pageIndexΒ #448

@bsutton

Description

@bsutton

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationpriority:5This label defines Bug/Enhancement with lowest priority.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions