Coder Social home page Coder Social logo

durhuman's Introduction

Human Duration

I am tired of seeing exp: 22220201838. What the f*** does that mean to a human? This little package let's you write exp: '23 days' and parse the string '23 days' into a number.

Install

yarn add durhuman

or

npm install durhuman

Types are included, if your into that.

Usage

By default parse will parse as seconds. Pass a seconds asUnit argument to have it converted to the unit you want.

import dur, { Duration } from 'durhuman'

dur('1 second')
// 1

dur('23 minutes')
// 1,380

dur('23 minutes', 'milliseconds')
// 1,380,000

dur('2 days')
// 172,800

dur('2 days', 'hours')
// 48

durhuman's People

Contributors

sodiray avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.