Skip to content

Support for relative date/time? #111

Open

Description

@gukii

Hi,

Congrats on the good work that you are doing!

Question. Do you plan to support for displaying dates relative to "now"

e.g.:
5 min ago
2 hours ago
2 days ago
...

react-intl has support for it, or maybe incorporate something like "react-timeago"

Activity

  1. cwtuan commented on Mar 4, 2019

    @cwtuan
    Collaborator

    Thanks for the suggestion.
    Currently, you could use moment.js for this purpose.
    JS:

    const ago = moment(new Date()).fromNow();
    return (<div>{intl.get("key", {ago})}</div>);

    Locale:

    {
       "key" : "Published {ago}"
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions