Skip to content

multipage throws an error when the dateTo is in the format of "YYYY-MM-DD" #60

@kan-fu

Description

@kan-fu

To reproduce, run the code below

from onc import ONC

onc = ONC("TOKEN")

data = onc.getRawdata(
    {
        "deviceCategoryCode": "ACOUSTICTRANSPONDER",
        "dateFrom": "2025-04-01",
        "dateTo": "2025-04-20",
        "locationCode": "BACSG.AT1",
    },
    allPages=True,
)

It happens when the dateTo is not in the format of "YYYY-MM-DDTHH:MM:SS.SSSZ" because the response automatically uses this format for dateFrom in the next value for pagination, and the datetime parsing applies timezone automatically for this format. So dateTo has no timezone but dateFrom has timezone info, making them incompatible to subtract with each other.

Also need to add a test to cover this case.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions