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

[🐛 BUG] Timezone problem on initialization #2229

Open
1 of 7 tasks
enarroied opened this issue Nov 8, 2024 · 0 comments
Open
1 of 7 tasks

[🐛 BUG] Timezone problem on initialization #2229

enarroied opened this issue Nov 8, 2024 · 0 comments
Labels
💥Malfunction Addresses an identified problem.

Comments

@enarroied
Copy link

enarroied commented Nov 8, 2024

What went wrong? 🤔

I have a question about how Taipy manages date and time. I see that Gui().run has timezone parameter, that defaults to client.

When I instantiate a variable with datetime.datetime.now(), I think this uses the server's local datetime.

What I observe by playing around with it, is that when a date is modified from a date visual element, that date is stored in GMT, but is displayed, in the date element, in the selected timezone.

I see 2 potential problems:
1- The timezone that I use to initialize the values is not GMT (unless the server is in a GMT zone). So this can lead to inconsistencies.
2- If I display the date in a text() element, I get the GMT date, but the date element shows the timezone I selected within run().

Date and time is always a painful thing, so I don't know if this is a bug, or if I'm being too maniac. This is not a technical bug, it would be a malfunction at most.

Expected Behavior

Time zones should be consistent acoss visual elements, and across time.
If Taipy uses GMT datetimes, values should always e in GMT, even if they are initialized before the run() (I think that is one of the problems, but I'm not 100% sure).

Steps to Reproduce Issue

This code helps to reproduce the issue, but you need to interact to data element to see it better:

import datetime as dt

import taipy.gui.builder as tgb
from taipy import Gui

with tgb.Page() as page:
    tgb.text("# Date and times", mode="md")

    tgb.text("{str(just_a_date)}")
    tgb.date("{just_a_date}", with_time=True)


if __name__ == "__main__":
    just_a_date = dt.datetime.now()
    print(f"Now it's: {just_a_date}")

    gui = Gui(page=page)
    gui.run(
        # time_zone="Indian/Maldives", # for example - a different timezone for me
    )

Runtime Environment

Windows 10, I used Python 12 within Anaconda, Taipy develop

Browsers

Brave

OS

Windows

Version of Taipy

4.0.0

Acceptance Criteria

  • A unit test reproducing the bug is added.
  • Any new code is covered by a unit tested.
  • Check code coverage is at least 90%.
  • The bug reporter validated the fix.
  • Related issue(s) in taipy-doc are created for documentation and Release Notes are updated.

Code of Conduct

  • I have checked the existing issues.
  • I am willing to work on this issue (optional)
@enarroied enarroied added the 💥Malfunction Addresses an identified problem. label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💥Malfunction Addresses an identified problem.
Projects
None yet
Development

No branches or pull requests

1 participant