Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pa-in.js 4.1KB

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