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

cannonian

v1.1.3

Published

Metric time converter

Downloads

5

Readme

Cannonian.js

##Install ###In Browser

###In Node.js Install using:

npm install cannonian

Include using:

var Cannonian = require("cannonian");

##Usage ###Constructor

var cannoniana = new Cannonian();
var cannonianb = new Cannonian(new Date(), 0, 0);

The constructor has 3 parameters:

  • p - Something to base the time off of. Default: time of execution
  • stz - Standard timezone. Default: calculated from Date objects
  • ctz - Cannonian timezone. Default: calculated from Standard timezone

####Recognised p formats

  • Cannonian Object - e.g. new Cannonian()
  • Date objects - e.g. new Date()
  • Date strings - e.g. "Tues Jan 1 2013 06:45:00 GMT+0000 (GMT)"
  • Decimals - e.g. 0.75 (equivalent to 6pm)
  • Standard time strings - e.g. "12:45:30"
  • Cannonian time strings - e.g. "53.125"
  • Cannonian time primitive objects - e.g. { hour: 50, minute: 3, centiminute: 50 }
  • Standard time primitive objects - e.g. { hour: 12, minute: 30, second: 30 }

###Public Functions ####set

var cannonian = new Cannonian();
cannonian.set("12.345");

Sets a new value for the Cannonian object. Parameter is equivalent to 'p' parameter of constructor (see above).

####toStan

var cannonian = new Cannonian("12:00");
cannonian.toStan(3); // "12:00:00"

Returns the standard time in 24-hour string.

####toCann

var cannonian = new Cannonian("12:00");
cannonian.toCann(3); // "50.000"

Returns the cannononian time in decimal-style string.

####toDec

var cannonian = new Cannonian("12.345");
cannonian.toDec(5); // 0.12345

Returns a decimal value equivalent to cannonian time.

####toCannObject

var cannonian = new Cannonian("12.345");
cannonian.toCannObject(); // { hour: 12, minu: 3, cent: 45, mill: 0, minute: 3, centiminute: 45, milliminute: 0 }

Returns a primitive object representation of Cannonian time.

####toStanObject

var cannonian = new Cannonian("12:30:45");
cannonian.toStanObject(); // { hour: 12, minu: 30, seco: 45, mill: 0, minute: 30, second: 45, millisecond: 0 }

Returns a primitive object representation of Standard time.