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

Introduce "time" data type to use with ui.markup and ui.text components to consistent with ui.table component. #1936

Closed
senalw opened this issue Apr 17, 2023 · 4 comments
Labels
feature Feature request

Comments

@senalw
Copy link

senalw commented Apr 17, 2023

Is your feature request related to a problem? Please describe

  • Wave supports time data type in ui.table component and it converts timestamp based on internationalisation. (User's local browser time format).
  • MLOps Wave app shows time and date in different components (ui.markup, ui.text) other than in ui.tables. Therefore it's better to have time data type to use with other wave components like ui.markup and ui.text. This is better for the consistency of the Wave API as well.

Describe the solution you'd like

Introduce time data type to use with ui.markup and ui.text components.

Describe alternatives you've considered

Alternative would be to get local browser time format from JS and use it in other components. But then its inconsistent with ui.table's mechanism.

CC @shereezhang @dulajra @ShehanIshanka

@mturoci
Copy link
Collaborator

mturoci commented Apr 17, 2023

Introduce time data type to use with ui.markup and ui.text components.

How do you envision this to work?

The proper, simplest and fastest way to do this is to get the browser locale, format your timestamps in python and render them wherever needed, be it ui.markup or ui.text.

@dulajra
Copy link
Contributor

dulajra commented Apr 24, 2023

How do you envision this to work?

I would expect this to work similarly to how i18n works with wave stat cards. @mturoci is that already supported by the framework? If that is supported by the framework then only we can say that wave supports i18n completely.

@mturoci
Copy link
Collaborator

mturoci commented Apr 24, 2023

I would expect this to work similarly to how i18n works with wave stat cards.

Format expressions do not allow arbitrary strings like Current date =${{intl foo minimum_fraction_digits=2 maximum_fraction_digits=2}} only =${{intl foo minimum_fraction_digits=2 maximum_fraction_digits=2}}. Another problem is that ui.text doesn't support data buffers and even if it did, the API would look like:

ui.text(content='Current date: =${{ intl foo ...}}', data=dict(foo='<timestamp>'))

Which is super bad compared to the solution I gave you above:

ui.text(f'Current date {my_formatter.format_date(<timestamp>)}')

is that already supported by the framework?

No and will most likely not be as it's very easy to implement.

@mturoci
Copy link
Collaborator

mturoci commented May 26, 2023

Closing as not going to implement since this feature is easily implementable within the app code and no better alternatives were provided.

@mturoci mturoci closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request
Projects
None yet
Development

No branches or pull requests

3 participants