npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

epoch-handler

v1.2.1

Published

A simple epoch handling library for javascript

Downloads

1

Readme

Epoch-Handler

This is a simple javascript library to allow easy handling of epoch times. Follow the below usage to get started with this package.

Installation

npm i epoch-handler --save

Usage

| props | defaults | description | | ------- | ----------- | ---------------------- | | epoch | required | The epoch value must be provided there are is an import called getEpochTimeLocale which can be imported from this package if you want to get the current epoch in seconds and then you will be able to add or subtract seconds from them. | | type | null | The type property allows you to access deaper functionality there is currently only on action that can be used which is time_until which will return the amount of time remaining between two epoch values.| | output | seconds | You can choose between two output types, these are object and seconds. The object setting returns an object containing hours, minutes and seconds between two epoch numbers. seconds returns the amount of seconds as a number between the epoch value passed in and the currect time epoch. | | format | null | The format options can be found below this allows you format an epoch value to give it a more human readable output |

import { 
  epochHandler, 
  getEpochTimeLocale, 
} from 'epoch-handler';

epochHandler({
  epoch: 1593529909 || getEpochTimeLocale()+50,
  type: 'time_until',
  output: 'seconds'
})

Formatting

The seperators between the Day month year can be any value you like so feel free to use - / : in the formatting string. This will also work for the hours minutes and seconds part of the string as well so fell free to use them as well.

| Valid Options | Return Value | | --------------------- | ---------------------- | | YYYY/MM/DD hh:mm:ss | 2020/01/22 12:03:23 | | DD/MM/YYYY hh:mm:ss | 22/01/2020 12:03:23 | | DD/MM/YY hh:mm:ss | 22/01/2020 12:03:23 | | YY/MM/DD hh:mm:ss | 20/01/22 12:03:23 | | DD/MM/YYYY | 22/01/2020 | | YYYY/MM/DD | 2020/01/22 | | YY/MM/DD | 20/01/22 | | hh:mm:ss | 12:03:23 |

import { 
  epochHandler, 
  getEpochTimeLocale,
} from 'epoch-handler';

epochHandler({
  epoch: 1593529909 || getEpochTimeLocale()+50,
  format: 'YYYY/MM/DD hh:mm:ss' 
})