Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript months array

'use strict';

(function(d){
    var mL = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
    var mS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];

    d.prototype.getLongMonth = d.getLongMonth = function getLongMonth (inMonth) {
        return gM.call(this, inMonth, mL);
    }

    d.prototype.getShortMonth = d.getShortMonth = function getShortMonth (inMonth) {
        return gM.call(this, inMonth, mS);
    }

    function gM(inMonth, arr){
        var m;

        if(this instanceof d){
            m = this.getMonth();
        }
        else if(typeof inMonth !== 'undefined') {
            m = parseInt(inMonth,10) - 1; // Subtract 1 to start January at zero
        }

        return arr[m];
    }
})(Date);
Comment

PREVIOUS NEXT
Code Example
Javascript :: js redirect to url new tab 
Javascript :: remove non alphanumeric characters javascript 
Javascript :: map range of numbers to another range 
Javascript :: redireccionar a una página con javascript 
Javascript :: jquery check if screen size 
Javascript :: yarn angular cli 
Javascript :: redirect javascript 
Javascript :: reload page javascript 
Javascript :: bootstrap5 cdn 
Javascript :: javascript string to double 
Javascript :: javascript void(0) href 
Javascript :: laravel migration change to make a column nullable 
Javascript :: npm update all packages 
Javascript :: json encode js 
Javascript :: jquery remove first character from string 
Javascript :: only letters and spaces regex 
Javascript :: install expo cli mac os 
Javascript :: only numeric values are allow in input jquery 
Javascript :: javascript set left margin 
Javascript :: angular valuechanges get id 
Javascript :: html include js file flask 
Javascript :: google dino game hack 
Javascript :: delay in javascript 
Javascript :: jquery ajax form submit 
Javascript :: how to unmount bottom tab screens 
Javascript :: slugify text javascript 
Javascript :: how to store objects in localstorage 
Javascript :: js check for url parameter 
Javascript :: js show span for 5 seconds 
Javascript :: modal.show jquery 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =