pa-in.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //! moment.js locale configuration
  2. //! locale : Punjabi (India) [pa-in]
  3. //! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit
  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 paIn = moment.defineLocale('pa-in', {
  36. // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi.
  37. months: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
  38. '_'
  39. ),
  40. monthsShort:
  41. 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
  42. '_'
  43. ),
  44. weekdays: 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split(
  45. '_'
  46. ),
  47. weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
  48. weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
  49. longDateFormat: {
  50. LT: 'A h:mm ਵਜੇ',
  51. LTS: 'A h:mm:ss ਵਜੇ',
  52. L: 'DD/MM/YYYY',
  53. LL: 'D MMMM YYYY',
  54. LLL: 'D MMMM YYYY, A h:mm ਵਜੇ',
  55. LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ',
  56. },
  57. calendar: {
  58. sameDay: '[ਅਜ] LT',
  59. nextDay: '[ਕਲ] LT',
  60. nextWeek: '[ਅਗਲਾ] dddd, LT',
  61. lastDay: '[ਕਲ] LT',
  62. lastWeek: '[ਪਿਛਲੇ] dddd, LT',
  63. sameElse: 'L',
  64. },
  65. relativeTime: {
  66. future: '%s ਵਿੱਚ',
  67. past: '%s ਪਿਛਲੇ',
  68. s: 'ਕੁਝ ਸਕਿੰਟ',
  69. ss: '%d ਸਕਿੰਟ',
  70. m: 'ਇਕ ਮਿੰਟ',
  71. mm: '%d ਮਿੰਟ',
  72. h: 'ਇੱਕ ਘੰਟਾ',
  73. hh: '%d ਘੰਟੇ',
  74. d: 'ਇੱਕ ਦਿਨ',
  75. dd: '%d ਦਿਨ',
  76. M: 'ਇੱਕ ਮਹੀਨਾ',
  77. MM: '%d ਮਹੀਨੇ',
  78. y: 'ਇੱਕ ਸਾਲ',
  79. yy: '%d ਸਾਲ',
  80. },
  81. preparse: function (string) {
  82. return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) {
  83. return numberMap[match];
  84. });
  85. },
  86. postformat: function (string) {
  87. return string.replace(/\d/g, function (match) {
  88. return symbolMap[match];
  89. });
  90. },
  91. // Punjabi notation for meridiems are quite fuzzy in practice. While there exists
  92. // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi.
  93. meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,
  94. meridiemHour: function (hour, meridiem) {
  95. if (hour === 12) {
  96. hour = 0;
  97. }
  98. if (meridiem === 'ਰਾਤ') {
  99. return hour < 4 ? hour : hour + 12;
  100. } else if (meridiem === 'ਸਵੇਰ') {
  101. return hour;
  102. } else if (meridiem === 'ਦੁਪਹਿਰ') {
  103. return hour >= 10 ? hour : hour + 12;
  104. } else if (meridiem === 'ਸ਼ਾਮ') {
  105. return hour + 12;
  106. }
  107. },
  108. meridiem: function (hour, minute, isLower) {
  109. if (hour < 4) {
  110. return 'ਰਾਤ';
  111. } else if (hour < 10) {
  112. return 'ਸਵੇਰ';
  113. } else if (hour < 17) {
  114. return 'ਦੁਪਹਿਰ';
  115. } else if (hour < 20) {
  116. return 'ਸ਼ਾਮ';
  117. } else {
  118. return 'ਰਾਤ';
  119. }
  120. },
  121. week: {
  122. dow: 0, // Sunday is the first day of the week.
  123. doy: 6, // The week that contains Jan 6th is the first week of the year.
  124. },
  125. });
  126. return paIn;
  127. })));