ctparse - Parse natural language time expressions in python version: 0.3.6
Python version: 3.11.1
Operating System: MacOS
Description
What is the easiest / best way to convert a timedelta object from a Duration object? I want to go from the string "in two days" to a timedelta -> datetime, but the only thing I can think of is to manually try to match up the ctparse enums and fill out the timedelta myself. Is that the best way or is there something I'm missing?
I am afraid you are right: you have to code that yourself. Duration does not have a build-in property to turn it into a timedelta. Likely somethings that would make sense to add.
Description
What is the easiest / best way to convert a
timedelta
object from aDuration
object? I want to go from the string "in two days" to a timedelta -> datetime, but the only thing I can think of is to manually try to match up the ctparse enums and fill out the timedelta myself. Is that the best way or is there something I'm missing?