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

dont force ampm #27

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
11 changes: 4 additions & 7 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,16 @@ def get_display_current_time(self, location=None, dtUTC=None):
use_24hour=self.use_24hour)

def get_spoken_current_time(self, location=None,
dtUTC=None, force_ampm=False):
dtUTC=None):
# Get a formatted spoken time based on the user preferences
dt = self.get_local_datetime(location, dtUTC)
if not dt:
return

# speak AM/PM when talking about somewhere else
say_am_pm = bool(location) or force_ampm

s = nice_time(dt, self.lang, speech=True,
use_24hour=self.use_24hour, use_ampm=say_am_pm)
use_24hour=self.use_24hour, use_ampm=not self.use_24hour)
# HACK: Mimic 2 has a bug with saying "AM". Work around it for now.
if say_am_pm:
if not self.use_24hour:
s = s.replace("AM", "A.M.")

return s
Expand Down Expand Up @@ -402,7 +399,7 @@ def handle_query_future_time(self, message):
return

location = self._extract_location(utt)
future_time = self.get_spoken_current_time(location, dt, True)
future_time = self.get_spoken_current_time(location, dt)
if not future_time:
return

Expand Down