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: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
  40. '_'
  41. ),
  42. weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
  43. weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
  44. weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
  45. weekdaysParseExact: true,
  46. longDateFormat: {
  47. LT: 'HH:mm',
  48. LTS: 'HH:mm:ss',
  49. L: 'DD/MM/YYYY',
  50. LL: 'D MMMM YYYY',
  51. LLL: 'D MMMM YYYY HH:mm',
  52. LLLL: 'dddd, D MMMM YYYY HH:mm',
  53. },
  54. meridiemParse: /ព្រឹក|ល្ងាច/,
  55. isPM: function (input) {
  56. return input === 'ល្ងាច';
  57. },
  58. meridiem: function (hour, minute, isLower) {
  59. if (hour < 12) {
  60. return 'ព្រឹក';
  61. } else {
  62. return 'ល្ងាច';
  63. }
  64. },
  65. calendar: {
  66. sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',
  67. nextDay: '[ស្អែក ម៉ោង] LT',
  68. nextWeek: 'dddd [ម៉ោង] LT',
  69. lastDay: '[ម្សិលមិញ ម៉ោង] LT',
  70. lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
  71. sameElse: 'L',
  72. },
  73. relativeTime: {
  74. future: '%sទៀត',
  75. past: '%sមុន',
  76. s: 'ប៉ុន្មានវិនាទី',
  77. ss: '%d វិនាទី',
  78. m: 'មួយនាទី',
  79. mm: '%d នាទី',
  80. h: 'មួយម៉ោង',
  81. hh: '%d ម៉ោង',
  82. d: 'មួយថ្ងៃ',
  83. dd: '%d ថ្ងៃ',
  84. M: 'មួយខែ',
  85. MM: '%d ខែ',
  86. y: 'មួយឆ្នាំ',
  87. yy: '%d ឆ្នាំ',
  88. },
  89. dayOfMonthOrdinalParse: /ទី\d{1,2}/,
  90. ordinal: 'ទី%d',
  91. preparse: function (string) {
  92. return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) {
  93. return numberMap[match];
  94. });
  95. },
  96. postformat: function (string) {
  97. return string.replace(/\d/g, function (match) {
  98. return symbolMap[match];
  99. });
  100. },
  101. week: {
  102. dow: 1, // Monday is the first day of the week.
  103. doy: 4, // The week that contains Jan 4th is the first week of the year.
  104. },
  105. });
  106. return km;
  107. })));