All files / src/impl english.js

84.38% Statements 27/32
73.68% Branches 14/19
100% Functions 17/17
84.38% Lines 27/32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120            9x                                 35x       3x       29x   3x   15x   9x   2x                 11x       30x       3x       29x   3x   16x   10x                 5x       5x       6x       2x       13x   2x   6x   5x             2x       18x       18x       7x      
/**
 * @private
 */
 
export class English {
  static get monthsLong() {
    return [
      'January',
      'February',
      'March',
      'April',
      'May',
      'June',
      'July',
      'August',
      'September',
      'October',
      'November',
      'December'
    ];
  }
 
  static get monthsShort() {
    return ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  }
 
  static get monthsNarrow() {
    return ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];
  }
 
  static months(length) {
    switch (length) {
      case 'narrow':
        return English.monthsNarrow;
      case 'short':
        return English.monthsShort;
      case 'long':
        return English.monthsLong;
      case 'numeric':
        return ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
      case '2-digit':
        return ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
      default:
        return null;
    }
  }
 
  static get weekdaysLong() {
    return ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
  }
 
  static get weekdaysShort() {
    return ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
  }
 
  static get weekdaysNarrow() {
    return ['M', 'T', 'W', 'T', 'F', 'S', 'S'];
  }
 
  static weekdays(length) {
    switch (length) {
      case 'narrow':
        return English.weekdaysNarrow;
      case 'short':
        return English.weekdaysShort;
      case 'long':
        return English.weekdaysLong;
      case 'numeric':
        return ['1', '2', '3', '4', '5', '6', '7'];
      default:
        return null;
    }
  }
 
  static get meridiems() {
    return ['AM', 'PM'];
  }
 
  static get erasLong() {
    return ['Before Christ', 'Anno Domini'];
  }
 
  static get erasShort() {
    return ['BC', 'AD'];
  }
 
  static get erasNarrow() {
    return ['B', 'A'];
  }
 
  static eras(length) {
    switch (length) {
      case 'narrow':
        return English.erasNarrow;
      case 'short':
        return English.erasShort;
      case 'long':
        return English.erasLong;
      default:
        return null;
    }
  }
 
  static meridiemForDateTime(dt) {
    return English.meridiems[dt.hour < 12 ? 0 : 1];
  }
 
  static weekdayForDateTime(dt, length) {
    return English.weekdays(length)[dt.weekday - 1];
  }
 
  static monthForDateTime(dt, length) {
    return English.months(length)[dt.month - 1];
  }
 
  static eraForDateTime(dt, length) {
    return English.eras(length)[dt.year < 0 ? 0 : 1];
  }
}