hi.js 4.6 KB

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