km.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //! moment.js locale configuration
  2. //! locale : Cambodian [km]
  3. //! author : Kruy Vanna : https://github.com/kruyvanna
  4. ;(function (global, factory) {
  5. typeof exports === 'object' && typeof module !== 'undefined'
  6. && typeof require === 'function' ? factory(require('../moment')) :
  7. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  8. factory(global.moment)
  9. }(this, (function (moment) { 'use strict';
  10. //! moment.js locale configuration
  11. var symbolMap = {
  12. 1: '១',
  13. 2: '២',
  14. 3: '៣',
  15. 4: '៤',
  16. 5: '៥',
  17. 6: '៦',
  18. 7: '៧',
  19. 8: '៨',
  20. 9: '៩',
  21. 0: '០',
  22. },
  23. numberMap = {
  24. '១': '1',
  25. '២': '2',
  26. '៣': '3',
  27. '៤': '4',
  28. '៥': '5',
  29. '៦': '6',
  30. '៧': '7',
  31. '៨': '8',
  32. '៩': '9',
  33. '០': '0',
  34. };
  35. var km = moment.defineLocale('km', {
  36. months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
  37. '_'
  38. ),
  39. monthsShort:
  40. 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
  41. '_'
  42. ),
  43. weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
  44. weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
  45. weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
  46. weekdaysParseExact: true,
  47. longDateFormat: {
  48. LT: 'HH:mm',
  49. LTS: 'HH:mm:ss',
  50. L: 'DD/MM/YYYY',
  51. LL: 'D MMMM YYYY',
  52. LLL: 'D MMMM YYYY HH:mm',
  53. LLLL: 'dddd, D MMMM YYYY HH:mm',
  54. },
  55. meridiemParse: /ព្រឹក|ល្ងាច/,
  56. isPM: function (input) {
  57. return input === 'ល្ងាច';
  58. },
  59. meridiem: function (hour, minute, isLower) {
  60. if (hour < 12) {
  61. return 'ព្រឹក';
  62. } else {
  63. return 'ល្ងាច';
  64. }
  65. },
  66. calendar: {
  67. sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',
  68. nextDay: '[ស្អែក ម៉ោង] LT',
  69. nextWeek: 'dddd [ម៉ោង] LT',
  70. lastDay: '[ម្សិលមិញ ម៉ោង] LT',
  71. lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
  72. sameElse: 'L',
  73. },
  74. relativeTime: {
  75. future: '%sទៀត',
  76. past: '%sមុន',
  77. s: 'ប៉ុន្មានវិនាទី',
  78. ss: '%d វិនាទី',
  79. m: 'មួយនាទី',
  80. mm: '%d នាទី',
  81. h: 'មួយម៉ោង',
  82. hh: '%d ម៉ោង',
  83. d: 'មួយថ្ងៃ',
  84. dd: '%d ថ្ងៃ',
  85. M: 'មួយខែ',
  86. MM: '%d ខែ',
  87. y: 'មួយឆ្នាំ',
  88. yy: '%d ឆ្នាំ',
  89. },
  90. dayOfMonthOrdinalParse: /ទី\d{1,2}/,
  91. ordinal: 'ទី%d',
  92. preparse: function (string) {
  93. return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) {
  94. return numberMap[match];
  95. });
  96. },
  97. postformat: function (string) {
  98. return string.replace(/\d/g, function (match) {
  99. return symbolMap[match];
  100. });
  101. },
  102. week: {
  103. dow: 1, // Monday is the first day of the week.
  104. doy: 4, // The week that contains Jan 4th is the first week of the year.
  105. },
  106. });
  107. return km;
  108. })));