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

@indaneey/timecall

v1.0.0

Published

timeCall.js is a simple library that used to get a human readable form of date object.

Downloads

2

Readme

timeCall.js

timeCall.js is a simple library that used to get a human readable form of date object.

Installation

# Basic Node.JS installation
npm install @indaneey/timecall --save

Syntax

Import timecall() as component

import { timeCall } from '@indaneey/timecall';

Examples

Calling timecall using require()

var timeCall = require('timecall');
var timenow = new timeCall();

Import the minified version of timeCall.min.js JavaScript library

<head>
<script src="timecall.min.js"></script>
</head>

and then in script tag create timeCall() instance

var timenow = new timeCall();

Initialize the timeCall with date parameter


  var timenow = new timeCall('2021/05/02 5:45:25') // or JavaScript Date object

timeCall methods

format() method

use this method to easly formatted Date object, this method takes two parameters the first one is Date and Time format pattern and second is some properties

Example

  var timenow = new timeCall(Date.now())
  timenow.format("DD MM YYYY hh mm a") // returns 03/11/2021 05:02AM
  timenow.format("EEEE DD MMMM YYYY HH mm") // returns Wednesday, 03 November 2021 15:02

You have to seperate each pattern by space.

This method has two properties

  • datedivider
  • timedivider

Example

    var timenow = new timeCall(Date.now())
    timenow.format("DD MM YYYY hh mm a", {
      datedivider: "-", // returns 03-11-2021 - this property will change the date divider sign
      timedivider: ":"  // returns 05:02AM - this property will change the time divider sign
    })

List of all Date and Time Pattern

| Pattern | Description | |---------|-------------| | EEEE | Day of the week | | MM | Month of the year in a two-digit format | | MMM | Abbreviated month of the year | | MMMM | Month of the year | | DD | Day of the month with leading zero | | d | Day of the month | | yy | Year in two-digit format | | yyyy | Year in four-digit format | | YYYY | Week-based year | | HH | Hour of the day (0-23) | | hh | Clock hour in AM/PM (1-12) format with leading zero 02:15 | | h | Clock hour in AM/PM (1-12) format without leading zero 2:15 | | mm | Minute with leading zero | | m | Minute without leading zero | | ss | Second | | a | AM/PM marker |

ago() method

use this method to get how long the date is passed, like 1 day ago and it will returns either string or object with date details.

Example

var ago = new timeCall('2022/05/02 12:20').ago() // returns 2 days 5 hours 26 minutes 47 seconds ago

This method has some properties

  • withtime
  • timeformat
  • json

Example of withtime and timeformat

  var timecall = new timeCall('2022/05/02 12:20').ago({
      withtime: true, // this will enable time or unable it
      timeformat:  "hh:mm", // this property will change the time format. "hh", "hh:mm" and "hh:mm:ss"
  }) // returns 2 days 5 hours 40 minutes ago

Example of json property this will return an object with the date and time details.

  var timecall = new timeCall('2022/05/02 12:20').ago({
    json: true // this will return json type date with the Date and Time details
  }) // returns { success: true, action: "ago", data: { days: 2, hours: 5, minutes: 42 }}

left() method

use this method to get how long the date is left, like 1 day 6 hours 34 minutes left and it will returns either string or object with date details.

Example

var left = new timeCall('2024/05/03 12:50').left() // returns 2 years 18 hours 38 minutes 12 seconds left

This method has some properties the same with ago() above

  • withtime
  • timeformat
  • json

timeCall.js

Developed by Indaneey_design. for any support contact me here