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

Format time using channel or bot's format #50

Merged
merged 1 commit into from
Jan 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions sopel_modules/youtube/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,22 @@ def _parse_datetime(date):


def _format_datetime(bot, trigger, date):
if type(date) != 'datetime':
if not isinstance(date, datetime):
date = _parse_datetime(date)
return tools.time.format_time(bot.db, bot.config, nick=trigger.nick,
channel=trigger.sender, time=date)
# use channel or bot's timezone (not user)
zone = tools.time.get_timezone(
db=bot.db,
config=bot.config,
channel=trigger.sender,
)
# use channel or bot's time format (not user)
return tools.time.format_time(
bot.db,
bot.config,
zone,
channel=trigger.sender,
time=date,
)


def _make_snippet_bidi_safe(snippet):
Expand Down