pa-in.js 4.3 KB

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