Giter VIP home page Giter VIP logo

countdown-x's Introduction

How to install

You can using a in 2 way

    npm install countdown-x
    npm i countdown-x

How to use

See the example below to use it

    var countdownX = require("countdown-x");

    // Using: countdown
    setInterval(() => {
        // it's was called every seconds

        console.log(countdownX.fromNow().countdown("2033/12/10 16:23:00")) // {days: 8, hours: "00", minutes: "05", months: 2, seconds: 44, years: 13}
    }, 1000)


    // Using: countdownEvery
    countdownX
    .fromNow()
    .countdownEvery("2033/12/10 16:23:00", { ms: 1000 }, (values) => {
        // Do something with values
        // it's was called every seconds
        
        console.log(values); // {days: 8, hours: "00", minutes: "05", months: 2, seconds: 44, years: 13}
    });

Documentation

  • eventDate format (ISO 8601 - UTC): yyyy/mm/dd HH:MM:SS
API Description Return
fromNow() Setup countdown destination void
countdown(eventDate) The countdown function {days, hours, minutes, months, seconds, years}
countdownEvery(eventDate, options{ms: number}, callback) The countdown function automatically according to predetermined time void

Versions history

The version Description Issues
v1.0.0 Project initialization No issue
v1.0.1 Clean code No issue
v1.0.2 Clean code No issue
v1.0.3 Clean code No issue
v1.0.4 Fix The countdown time is wrong
v1.0.4-1 Refactoring the source code Structure
v1.0.4-2 Change example code No issue
v1.0.5 Add type and supported suggest code No issue
v1.1.0 add new function support auto setInterval No issue

countdown-x's People

Contributors

duongductrong avatar

Stargazers

 avatar

Watchers

 avatar  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.