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

Add support for timestamp timezones for chat message #5961

Merged
merged 7 commits into from
Dec 5, 2023

Conversation

ahuang11
Copy link
Contributor

Closes #5699

@ahuang11 ahuang11 changed the title Add support for timezones for chat message Add support for timestamp timezones for chat message Nov 30, 2023
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (573497c) 84.65% compared to head (a77443d) 82.58%.

Files Patch % Lines
panel/chat/message.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5961      +/-   ##
==========================================
- Coverage   84.65%   82.58%   -2.07%     
==========================================
  Files         291      291              
  Lines       43458    43479      +21     
==========================================
- Hits        36788    35909     -879     
- Misses       6670     7570     +900     
Flag Coverage Δ
ui-tests 38.36% <18.18%> (-2.47%) ⬇️
unitexamples-tests 72.23% <95.45%> (-0.50%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

panel/chat/message.py Outdated Show resolved Hide resolved
@maximlt
Copy link
Member

maximlt commented Dec 1, 2023

Does this implement the actual request to display the time in the browser timezone?

Probably the vast majority of users wants to see times in their browser timezone and this is confusing for them?

@philippjfr
Copy link
Member

Indeed would be nice to automatically grab the timezone if pn.state.browser_info is defined.

@ahuang11
Copy link
Contributor Author

ahuang11 commented Dec 1, 2023

Okay implemented zoneinfo + pn.state.browser_info.timezone

@philippjfr philippjfr merged commit 29464f0 into main Dec 5, 2023
12 of 13 checks passed
@philippjfr philippjfr deleted the chat_message_timezone branch December 5, 2023 08:39
@DmitriyLeybel
Copy link

Using Jupyter notebooks with VS Code causes it to error out when using the ChatInterface layout due to pn.state.browser_info not being available.

import panel as pn
from panel.chat import ChatMessage, ChatInterface, ChatFeed

pn.extension()
def guided_get_num(contents, user, instance):
    if isinstance(contents, str):
        num = len(contents)
        instance.active = 1  # change to IntSlider tab
    else:
        num = contents
        instance.active = 0  # Change to TextAreaInput tab
    return f"Got {num}."

pn.chat.ChatInterface( 
    callback=guided_get_num,
    widgets=[
        pn.widgets.TextAreaInput(placeholder="Enter some text to get a count!"),
        pn.widgets.IntSlider(name="Number Input", end=10)
],
)

image

@ahuang11
Copy link
Contributor Author

Thanks! Fix is in #6122 which I think can go into 1.3.7 release next week.

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

Successfully merging this pull request may close these issues.

ChatMessage browser timezone support
4 participants