After looking at the examples on github and on readthedocs, I can see that extract_datetime() is expecting a string argument. I tried str(message) and then normalize(message), but both returned TypeError: expected string or bytes-like object.
The method works if I provide a string argument directly in the code. But I don’t see how to pass the utterance as a string.
Is there a way to cast a message object as a string?
Can somebody show me where the documentation is about message objects?
btw. messages with intents structured like some {superb} intent (padatious) or .require("superb") - or variations thereof - (adapt) will carry message.data[“superb”]. (while the whole utterance still on data) Just FYI.
Just to add - the now_local() you have as the reference datetime is added automatically by mycroft-core. Eg by default we assume the frame of reference for what was said is the current time in the devices configured location.
So if I said:
“they want to catch up tomorrow in Paris”
that would be tomorrow in the context of me being in Australia and the time being 2:25pm on the 2nd of December (which the device already knows). So I can just use:
extract_datetime(message.data.get("utterance"))
If the utterance related to a different timezone, or a different point in time, you can pass in a different “anchor time”. Eg:
“they want to catch up tomorrow in Paris”
We might then want to pass in the current datetime with a Paris timezone.