Nodejs Week Get getWeekDayName(lang)

Here you can find the source of getWeekDayName(lang)

Method Source Code

Date.prototype.getWeekDayName = function(lang) {
    lang = lang && (lang in Date.locale) ? lang : 'de';
    return Date.locale[lang].day_names[this.getDay()];
};
Date.locale = {//  www  .  java 2  s  .c  om
    de: {
        month_names: ['Januar', 'Februar', 'M?', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
        month_names_short: ['Jan', 'Feb', 'M?, 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
    
        day_names: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
        day_names_short: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa']
    }
};

Related

  1. getWeek()
    Date.prototype.getWeek = function()
        var today = new Date(this.setHours(0, 0, 0, 0));
        var date = today.getDate() - today.getDay();
        var StartDate = new Date(today.setDate(date));
        var EndDate = new Date(today.setDate(date + 6));
        return [StartDate, EndDate];
    
  2. getWeek()
    Date.prototype.getWeek = function () {
      var onejan = new Date(this.getFullYear(), 0, 1);
      var time   = this.getMilliseconds() +
                   this.getSeconds() * 1000 +
                   this.getMinutes() * 60 * 1000 +
                   this.getHours() * 60 * 60 * 1000;
      return Math.ceil((((this - onejan - time) / 86400000) + onejan.getDay() + 1) / 7);
    };
    
  3. getWeek(dowOffset)
    Date.prototype.getWeek = function (dowOffset) {
        dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 1; 
        var newYear = new Date(this.getFullYear(),0,1);
        var day = newYear.getDay() - dowOffset; 
        day = (day >= 0 ? day : day + 7);
      var daynum = Math.floor((this.getTime() - newYear.getTime() - 
      (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
      var weeknum;
      if(day < 4) {
    ...
    
  4. getWeek(dowOffset)
    Date.prototype.getWeek = function (dowOffset) {
      dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 0; 
      var newYear = new Date(this.getFullYear(),0,1);
      var day = newYear.getDay() - dowOffset; 
      day = (day >= 0 ? day : day + 7);
      var daynum = Math.floor((this.getTime() - newYear.getTime() -
      (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
      var weeknum;
      if(day < 4) {
    ...
    
  5. getWeekDayName()
    Date.prototype.getWeekDayName = function(){
      return this.weekDayName()[this.getDay()];
    };
    Date.prototype.weekDayName = function(){
      return ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
    };
    sec = 1000;
    min = 60*sec;
    hour = 60*min;
    ...
    
  6. getWeekDayNameShort(lang)
    Date.prototype.getWeekDayNameShort = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'de';
        return Date.locale[lang].day_names_short[this.getDay()];
    };
    Date.locale = {
        de: {
            month_names: ['Januar', 'Februar', 'M?', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
            month_names_short: ['Jan', 'Feb', 'M?, 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
            day_names: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
    ...
    
  7. getWeekNumber()
    Date.prototype.getWeekNumber = function(){
        const date = new Date(+this);
        date.setHours(0,0,0);
        date.setDate(date.getDate()+4-(date.getDay()||7));
        return Math.ceil((((date-new Date(date.getFullYear(),0,1))/8.64e7)+1)/7);
    };
    
  8. getWeekNumber()
    Date.prototype.getWeekNumber = function(){
        var d = new Date(+this);
        d.setHours(0,0,0);
        d.setMilliseconds(0);
        d.setDate(d.getDate()+4-(d.getDay()||7));
        return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7);
    };
    
  9. getWeekNumber()
    Date.prototype.getWeekNumber = function(){
      var d = new Date(+this);
      d.setHours(0,0,0);
      d.setDate(d.getDate()+4-(d.getDay()||7));
      return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7);
    };
    function(doc) {
      var docdate = new Date(doc.created_at);
      if (doc.type === "entry")
    ...