Neolithic Psychedelic Mushrooms
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    jstimepublic

    JS Time

    Works both on Node and the browser

    require('./lib/jsTime.js');
    <script type="type/javascript" src="js/jsTime.js"></ script>

    After that you can do things like these:

    setTimeout(function(){
    	alert('After 10 seconds');
    }, 10..seconds());
    
    setInterval(function(){
    	alert('Every 1.5 hours');
    }, 1.5.minutes());
    
    // Timestamp of 3 days from now
    var expire = new Date() + 3..days();
    

    The double dot (..) is needed for integer numbers, else the interpreter thinks it's a mistyped float number. Another possible syntax that is just a it longer but less magical would be:

    var expire = new Date() + (3).days();
    

    Pick the one you prefer.

    TODO

    • Add a getter version that only works on modern browsers

    Keywords

    none

    install

    npm i jstime

    Downloadsweekly downloads

    2

    version

    1.0.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar