code: function(opts, day, abbr)
      {
          day += opts.firstDay;
          while (day >= 7) {
              day -= 7;
          }
          return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
      }
docs: feature detection and helper functions