Long story short, the correct idiom is “invest time in something” (meaning “to put your time into something”):
A few examples from the media:
Social animals invest a lot of time in rearing their young.
Some firms were awarded multiple grants that enabled them to invest more time in developing their technology.
It is also worth noting that “invest time in” is a relatively new expression, as the following picture shows (it shows how often it was used in the given year in English literature).
The use of the idiom only caught on in the 1960s, and it would have been considered unnatural before then. Nevertheless, it is completely acceptable (and commonly used) in modern English.