Support for 12hour format from config file for what_time_is_it intent

This commit is contained in:
Mathieu B 2021-07-26 21:48:23 +02:00
parent 37678cb247
commit 1e7f1529d2

View File

@ -1,9 +1,18 @@
import time
import utils.intents_utils import utils.intents_utils
from utils import config_utils
def what_time_is_it(): def what_time_is_it():
current_time = time.localtime()
response = utils.intents_utils.get_response("what_time_is_it") response = utils.intents_utils.get_response("what_time_is_it")
response.replace("{time}", "18:41")
if config_utils.get_in_config("12HOURS-FORMAT"):
response = response.replace('{time}', time.strftime("%I:%M %p", current_time))
else:
response = response.replace('{time}', time.strftime("%H:%M", current_time))
return response return response