Skip to content
Merged
Changes from 1 commit
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
19 changes: 17 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import mycroft.audio
from adapt.intent import IntentBuilder
from lingua_franca.format import date_time_format
Comment thread
domcross marked this conversation as resolved.
Outdated
from mycroft.util.format import nice_date, nice_duration, nice_time
from mycroft.messagebus.message import Message
from mycroft import MycroftSkill, intent_handler
Expand Down Expand Up @@ -622,12 +623,26 @@ def show_date_mark1(self, location, day):
def get_weekday(self, day=None, location=None):
if not day:
day = self.get_local_datetime(location)
return day.strftime("%A")
weekday = nice_date(day) # forces lingua_franca to initialize
Comment thread
domcross marked this conversation as resolved.
Outdated
if self.lang in date_time_format.lang_config.keys():
weekday = list(
date_time_format.lang_config[self.lang]['weekday'].values())[day.weekday()]
Comment thread
domcross marked this conversation as resolved.
Outdated
else:
weekday = day.strftime("%A")
return weekday
Comment thread
domcross marked this conversation as resolved.
Outdated

def get_month_date(self, day=None, location=None):
if not day:
day = self.get_local_datetime(location)
return day.strftime("%B %d")
month = nice_date(day) # forces lingua_franca to initialize
if self.lang in date_time_format.lang_config.keys():
month = date_time_format.lang_config[self.lang]['month'][str(int(day.strftime("%m")))]
else:
month = day.strftime("%B")
if self.config_core.get('date_format') == 'MDY':
return "{} {}".format(month, day.strftime("%d"))
else:
return "{}. {}".format(day.strftime("%d"), month)
Comment thread
domcross marked this conversation as resolved.
Outdated

def get_year(self, day=None, location=None):
if not day:
Expand Down