hi.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //! moment.js locale configuration
  2. //! locale : Hindi [hi]
  3. //! author : Mayank Singhal : https://github.com/mayanksinghal
  4. import moment from '../moment';
  5. var symbolMap = {
  6. 1: '१',
  7. 2: '२',
  8. 3: '३',
  9. 4: '४',
  10. 5: '५',
  11. 6: '६',
  12. 7: '७',
  13. 8: '८',
  14. 9: '९',
  15. 0: '०',
  16. },
  17. numberMap = {
  18. '१': '1',
  19. '२': '2',
  20. '३': '3',
  21. '४': '4',
  22. '५': '5',
  23. '६': '6',
  24. '७': '7',
  25. '८': '8',
  26. '९': '9',
  27. '०': '0',
  28. };
  29. export default moment.defineLocale('hi', {
  30. months: 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split(
  31. '_'
  32. ),
  33. monthsShort: 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split(
  34. '_'
  35. ),
  36. monthsParseExact: true,
  37. weekdays: 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
  38. weekdaysShort: 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'),
  39. weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'),
  40. longDateFormat: {
  41. LT: 'A h:mm बजे',
  42. LTS: 'A h:mm:ss बजे',
  43. L: 'DD/MM/YYYY',
  44. LL: 'D MMMM YYYY',
  45. LLL: 'D MMMM YYYY, A h:mm बजे',
  46. LLLL: 'dddd, D MMMM YYYY, A h:mm बजे',
  47. },
  48. calendar: {
  49. sameDay: '[आज] LT',
  50. nextDay: '[कल] LT',
  51. nextWeek: 'dddd, LT',
  52. lastDay: '[कल] LT',
  53. lastWeek: '[पिछले] dddd, LT',
  54. sameElse: 'L',
  55. },
  56. relativeTime: {
  57. future: '%s में',
  58. past: '%s पहले',
  59. s: 'कुछ ही क्षण',
  60. ss: '%d सेकंड',
  61. m: 'एक मिनट',
  62. mm: '%d मिनट',
  63. h: 'एक घंटा',
  64. hh: '%d घंटे',
  65. d: 'एक दिन',
  66. dd: '%d दिन',
  67. M: 'एक महीने',
  68. MM: '%d महीने',
  69. y: 'एक वर्ष',
  70. yy: '%d वर्ष',
  71. },
  72. preparse: function (string) {
  73. return string.replace(/[१२३४५६७८९०]/g, function (match) {
  74. return numberMap[match];
  75. });
  76. },
  77. postformat: function (string) {
  78. return string.replace(/\d/g, function (match) {
  79. return symbolMap[match];
  80. });
  81. },
  82. // Hindi notation for meridiems are quite fuzzy in practice. While there exists
  83. // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
  84. meridiemParse: /रात|सुबह|दोपहर|शाम/,
  85. meridiemHour: function (hour, meridiem) {
  86. if (hour === 12) {
  87. hour = 0;
  88. }
  89. if (meridiem === 'रात') {
  90. return hour < 4 ? hour : hour + 12;
  91. } else if (meridiem === 'सुबह') {
  92. return hour;
  93. } else if (meridiem === 'दोपहर') {
  94. return hour >= 10 ? hour : hour + 12;
  95. } else if (meridiem === 'शाम') {
  96. return hour + 12;
  97. }
  98. },
  99. meridiem: function (hour, minute, isLower) {
  100. if (hour < 4) {
  101. return 'रात';
  102. } else if (hour < 10) {
  103. return 'सुबह';
  104. } else if (hour < 17) {
  105. return 'दोपहर';
  106. } else if (hour < 20) {
  107. return 'शाम';
  108. } else {
  109. return 'रात';
  110. }
  111. },
  112. week: {
  113. dow: 0, // Sunday is the first day of the week.
  114. doy: 6, // The week that contains Jan 6th is the first week of the year.
  115. },
  116. });