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

Wide support for datetime.(date|datetime) #3650

Closed
2 tasks done
dangotbanned opened this issue Oct 22, 2024 · 1 comment
Closed
2 tasks done

Wide support for datetime.(date|datetime) #3650

dangotbanned opened this issue Oct 22, 2024 · 1 comment

Comments

@dangotbanned
Copy link
Member

dangotbanned commented Oct 22, 2024

What is your suggestion?

While I was writing #3643 (comment), I was unsatisfied with how a user would need to handle stdlib types.

For example, these two are functionally equivalent:

from datetime import date, datetime

import altair as alt

window_stdlib = (
    datetime(2005, 1, 1).timestamp() * 1e3,
    datetime(2009, 1, 1).timestamp() * 1e3,
)
window_alt = alt.DateTime(year=2005), alt.DateTime(year=2009)

brush = alt.selection_interval(encodings=["x"], value={"x": window_stdlib})
brush = alt.selection_interval(encodings=["x"], value={"x": window_alt})

The need to convert from a format python understands, to one which javascript expects; really seems like a detail that altair should be handling.

Sub Issues

I've opened sub-issues, with this as a parent.

I had already implemented some level of support for these locally, but beyond the shared topic - they touch completely different areas of altair.
For that reason, I'm going to track in smaller individual PRs.

The end goal will be supporting datetime.(date|datetime) in the same way (int|float|bool|str) can be used (schema permitting)

Note

Both original sub-issues are now merged (#3651), (#3652)
Leaving this open in case we discover any blind spots before 5.5.0

Related

@joelostblom
Copy link
Contributor

joelostblom commented Oct 23, 2024

The need to convert from a format python understands, to one which javascript expects; really seems like a detail that altair should be handling.

I totally agree, thanks for working on this @dangotbanned!

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

No branches or pull requests

2 participants