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

Unable to compare date objects #4304

Open
goncalog opened this issue Nov 5, 2024 · 1 comment
Open

Unable to compare date objects #4304

goncalog opened this issue Nov 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@goncalog
Copy link

goncalog commented Nov 5, 2024

Describe the bug
I'm getting an error when trying to compare two date objects and one of them is a State var (see code below)

To Reproduce
Here's a code example

rx.flex(
     rx.cond(
         datetime.now(pytz.utc).date() <= competition.end_date,
         rx.button("Join", on_click=lambda: rx.redirect(f"/competitions/{competition.id}/join"), size="4"),
     ),
 ),

and the error I'm getting:
reflex.utils.exceptions.VarTypeError: Unsupported Operand type(s) for <: state__state.selected_competition?.end_date of type date and 2024-11-05 of type date

Expected behavior
No errors raised

Screenshots
Na

Specifics (please complete the following information):

  • Python Version: 3.12
  • Reflex Version: 0.5.2
  • OS: macOS Sonoma 14.5
  • Browser (Optional): Firefox

Additional context
Na

@goncalog goncalog added the bug Something isn't working label Nov 5, 2024
Copy link

linear bot commented Nov 5, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant