“месяцы JS” Ответ

JavaScript Money 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);
Bloody Baboon

JavaScript Дата 3 месяца назад

var d = new Date();
d.setMonth(d.getMonth() - 3);
Anxious Angelfish

месяцы JS

const months = Array.from({ length: 12 }, (_, monthNumber) => {
    const date = new Date(0, monthNumber);
    return date.toLocaleDateString('pt-BR', {month: "long"});
})

// ['janeiro', 'fevereiro'....]
Lucas Juan

JS несколько месяцев назад

var d = new Date();
d.setMonth(d.getMonth() - 3);
Defiant Dragonfly

Ответы похожие на “месяцы JS”

Вопросы похожие на “месяцы JS”

Больше похожих ответов на “месяцы JS” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования