New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hologo

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hologo

A lightweight library that is used to find out humanly readable time differences between now and past date

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

logo

Build Status Code Climate Node Version Jest Prettier Downloads License

A lightweight (1 KB) library that is used to find out humanly readable time differences between now and past date

Install

$ npm install hologo

As of NPM 5.0.0, installed modules are added as a dependency by default, so the --save option is no longer used. The other save options still exist and are listed in the documentation for npm install.

When is it useful

The module will result in the same relative date outcome like StackOverflow sign-up date of users.

Example Image

Usage

Example current date: April 18, 2018 12:00:00

JavaScript

const memberFor = require('hologo');

memberFor.hologo('2018/04/18 11:45:00');
//=> '15 minutes'

memberFor.hologo('2018/04/18 11:00:00');
//=> '1 hour'

memberFor.hologo('2018-04-18 10:00:00');
//=> '2 hours'

memberFor.hologo('2018/04/17');
//=> '1 day'

memberFor.hologo('1522800000000'); // 04/04/2018 12:00:00 AM
//=> '14 days'

memberFor.hologo('2017/05/18');
//=> '11 months'

memberFor.hologo('2017/04/18');
//=> '1 year'

memberFor.hologo('04-20-2022');
//=> '0 seconds'

TypeScript

import { hologo } from 'hologo';

hologo('2017/03/18');
//=> '1 year, 1 month'

hologo('2012-02-14');
//=> '6 years, 3 months'

API

hologo(date, option)

date

Type: string

You may pass it either any valid date string or timestamp in milliseconds.

option

Type: string
Default: Date.now()

If set, it will compare to the first parameter. Otherwise, it will stick with the current date.

License

MIT © JeffMinsungKim

Keywords

FAQs

Package last updated on 04 Mar 2019

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