Refactor parse_datetime util.

- Avoid changing locale to parse timestamps.
- Use emails RFC 2822 parser.
- Added a test.