Implement timedeltas for to_json

Closes #9027
if there's another place where these constants live and i've replicated something, let me know