Relative datetimes (e.g. "42m ago") are displayed for posts, comments,
user pages, community cards, and site cards. This patch wraps these
relative datetimes in a `<time>` tag which has a `title` attribute and
an ISO 8601 `datetime` attribute. The `title` allows users to see a
full, non-relative timestamp when hovering with the mouse.
As we build the map of nodes, keep track of the minimum depth level.
Afterwards, nodes at the minimum depth level go into the tree as the
roots.
We no longer need to check if the tree belongs to a parent comment or
not.
Fixes#36 more.
For posts, comments, and other objects, the `published` attribute is a
string containing an ISO 8601 timestamp. This timestamp is UTC, though
it is not explicit in the string's contents. When the `Date` constructor
is used on such strings, they are parsed as though they are local
timestamps. According to [1]:
> When the time zone offset is absent, date-only forms are
> interpreted as a UTC time and date-time forms are interpreted as local
> time. This is due to a historical spec error that was not consistent
> with ISO 8601 but could not be changed due to web
> compatibility.
This patch explicitly appends a 'Z' to the `published` string when it is
used as the argument to the `Date` constructor.
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
Need to set type_ to 'All' when calling getComments(). Otherwise,
trying sort the comments on a post by "Top" or "New" will refresh
without any comments.