Restrict special datetime handling to parts of messages

This is an alternate implementation of #826.
Oops, that was a temporary hack to test stuff with that I forgot to clean up. Thanks.