Nocturnal Practitioners of Magic
    Wondering what’s next for npm?Check out our public roadmap! »

    week-identifier

    1.0.2 • Public • Published

    npm mit license build status coverage status deps status

    Get unique and sequential current week identifier for given valid Date string format or Date object. Week #1 is starting on January 05, 1970.

    Install

    npm i --save week-identifier
    npm test
    week-identifier --help
    

    API

    For more use-cases see the tests

    weekIdentifier

    Get unique and sequential current week identifier for given valid Date string format

    • [date] {String} every valid Date-ish string format
    • return {Number}

    Example:

    var weekIdentifier = require('week-identifier');
     
     // august 12, 2016
    weekIdentifier();
    //=> 2432
     
    weekIdentifier('January 05, 1970 00:00:00');
    //=> 1
     
    weekIdentifier('January 12, 1970 00:00:00');
    //=> 2
     
    weekIdentifier(new Date('August 12, 2016'));
    //=> 2432
     
    weekIdentifier('08/12/2016');
    //=> 2432
     
    weekIdentifier('August 12, 2016');
    //=> 2432
     
    weekIdentifier(new Date('August 19, 2016'));
    //=> 2433
     

    weekIdentifier.dateFromWeek

    Get monday date of the given week identifier or January 5, 1970 00:00:00 if weekIdentifier is <= 1.

    • [number] {String} every valid number > 0
    • return {Date}

    Example:

    var weekIdentifier = require('week-identifier');
     
    weekIdentifier.dateFromWeek(2433);
    //=> August 15, 2016 00:00:00
     
    weekIdentifier.dateFromWeek(1);
    //=> January 05, 1970 00:00:00
     

    CLI

    You can just run week-identifier --help for more information

    License MIT license

    Copyright (c) 2016 [Clément Billiot], contributors.
    Released under the MIT license.


    Install

    npm i week-identifier

    DownloadsWeekly Downloads

    45

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    16.8 kB

    Total Files

    14

    Last publish

    Collaborators

    • avatar