Socket
Socket
Sign inDemoInstall

react-timestamp

Package Overview
Dependencies
3
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-timestamp

A React component for displaying a datetime in the local timezone


Version published
Weekly downloads
2K
increased by15.99%
Maintainers
1
Install size
7.57 kB
Created
Weekly downloads
 

Readme

Source

React Timestamp

Render a nice looking time.

Usage

If you only provide a date then it will just format it nicely:

<Timestamp date={Date} /> // 26 Mar 2018, 10:30am

If you enable relative then you'll get something like:

<Timestamp relative date={Date} /> // 4 hours ago
<Timestamp relative date={Date} /> // in 4 hours
<Timestamp relative date={Date} relativeTo={Date} /> // 4 hours
<Timestamp relative date={Date} relativeTo={Date} /> // 2 years

<Timestamp relative date={Date} autoUpdate /> // 1 minute ago, 2 minutes ago, 3 minutes ago

Other options are set by passing an options prop:

<Timestamp date={Date} options={{ includeDay: true, twentyFourHour: true }} /> // Tuesday, 26 Mar 2018, 16:30

Authors

  • Nathan Hoad - nathan@nathanhoad.net

Keywords

FAQs

Last updated on 16 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc