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.

gu.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //! moment.js locale configuration
  2. //! locale : Gujarati [gu]
  3. //! author : Kaushik Thanki : https://github.com/Kaushik1987
  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('gu', {
  30. months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split(
  31. '_'
  32. ),
  33. monthsShort:
  34. 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split(
  35. '_'
  36. ),
  37. monthsParseExact: true,
  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. // Gujarati 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 Gujarati.
  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. });