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.

is.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Icelandic [is]
  2. import dayjs from '../index';
  3. var texts = {
  4. s: ['nokkrar sekúndur', 'nokkrar sekúndur', 'nokkrum sekúndum'],
  5. m: ['mínúta', 'mínútu', 'mínútu'],
  6. mm: ['mínútur', 'mínútur', 'mínútum'],
  7. h: ['klukkustund', 'klukkustund', 'klukkustund'],
  8. hh: ['klukkustundir', 'klukkustundir', 'klukkustundum'],
  9. d: ['dagur', 'dag', 'degi'],
  10. dd: ['dagar', 'daga', 'dögum'],
  11. M: ['mánuður', 'mánuð', 'mánuði'],
  12. MM: ['mánuðir', 'mánuði', 'mánuðum'],
  13. y: ['ár', 'ár', 'ári'],
  14. yy: ['ár', 'ár', 'árum']
  15. };
  16. function resolveTemplate(key, number, isFuture, withoutSuffix) {
  17. var suffixIndex = isFuture ? 1 : 2;
  18. var index = withoutSuffix ? 0 : suffixIndex;
  19. var keyShouldBeSingular = key.length === 2 && number % 10 === 1;
  20. var correctedKey = keyShouldBeSingular ? key[0] : key;
  21. var unitText = texts[correctedKey];
  22. var text = unitText[index];
  23. return key.length === 1 ? text : "%d " + text;
  24. }
  25. function relativeTimeFormatter(number, withoutSuffix, key, isFuture) {
  26. var template = resolveTemplate(key, number, isFuture, withoutSuffix);
  27. return template.replace('%d', number);
  28. }
  29. var locale = {
  30. name: 'is',
  31. weekdays: 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'),
  32. months: 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'),
  33. weekStart: 1,
  34. weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
  35. monthsShort: 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
  36. weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
  37. ordinal: function ordinal(n) {
  38. return n;
  39. },
  40. formats: {
  41. LT: 'H:mm',
  42. LTS: 'H:mm:ss',
  43. L: 'DD.MM.YYYY',
  44. LL: 'D. MMMM YYYY',
  45. LLL: 'D. MMMM YYYY [kl.] H:mm',
  46. LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm'
  47. },
  48. relativeTime: {
  49. future: 'eftir %s',
  50. past: 'fyrir %s síðan',
  51. s: relativeTimeFormatter,
  52. m: relativeTimeFormatter,
  53. mm: relativeTimeFormatter,
  54. h: relativeTimeFormatter,
  55. hh: relativeTimeFormatter,
  56. d: relativeTimeFormatter,
  57. dd: relativeTimeFormatter,
  58. M: relativeTimeFormatter,
  59. MM: relativeTimeFormatter,
  60. y: relativeTimeFormatter,
  61. yy: relativeTimeFormatter
  62. }
  63. };
  64. dayjs.locale(locale, null, true);
  65. export default locale;