Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fancy-timestamp

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fancy-timestamp

Create natural language from UNIX timestamps

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

#Fancy Timestamp

Use this to create natural language for your unix timestamps (similar to Facebook's)

Plays well with browserify

#Usage Install with NPM and require where needed.

npm install fancy-timestamp
var fancyTimestamp = require('fancy-timestamp');

Fancy Timestamp can accept normal timestamps composed of seconds.

var normalTimestamp = 1342123755; //Using only seconds

var fancyTimestampString = fancyTimestamp(normalTimestamp); // result == "8 minutes ago"

It can also accept timestamps composed of milliseconds such as the ones JavaScript defaults to. To parse millisecond timestamps pass a second parameter of 'true'.

var javascriptTimestamp = (new Date()).getTime(); //Using JavaScript's timestamp composed of milliseconds

fancyTimestampString = fancyTimestamp(javascriptTimestamp, true); // result == "Just now"

Where appropriate, fancy-timestamp will apply the appropriate ending to the natural language text such as 'tomorrow' or 'away' for dates in the future, and 'yesterday' or 'ago' for dates in the past.

#License MIT license

Keywords

FAQs

Package last updated on 18 Feb 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc