Use now() from dt_util for Date and Time intents (#131049)

Use now() from dt_util
This commit is contained in:
Paulus Schoutsen 2024-11-20 11:27:57 -05:00 committed by GitHub
parent 2cd05e224a
commit c56f377cd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,6 @@
from __future__ import annotations
from datetime import datetime
import logging
from typing import Any, Protocol
@ -42,6 +41,7 @@ from homeassistant.const import (
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant, State
from homeassistant.helpers import config_validation as cv, integration_platform, intent
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import dt as dt_util
from .const import DOMAIN, TIMER_DATA
from .timers import (
@ -405,7 +405,7 @@ class GetCurrentDateIntentHandler(intent.IntentHandler):
async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
response = intent_obj.create_response()
response.async_set_speech_slots({"date": datetime.now().date()})
response.async_set_speech_slots({"date": dt_util.now().date()})
return response
@ -417,7 +417,7 @@ class GetCurrentTimeIntentHandler(intent.IntentHandler):
async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
response = intent_obj.create_response()
response.async_set_speech_slots({"time": datetime.now().time()})
response.async_set_speech_slots({"time": dt_util.now().time()})
return response