pa-in.js 4.6 KB

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