lv.js (4137B)
1//! moment.js locale configuration 2//! locale : Latvian [lv] 3//! author : Kristaps Karlsons : https://github.com/skakri 4//! author : Jānis Elmeris : https://github.com/JanisE 5 6;(function (global, factory) { 7 typeof exports === 'object' && typeof module !== 'undefined' 8 && typeof require === 'function' ? factory(require('../moment')) : 9 typeof define === 'function' && define.amd ? define(['../moment'], factory) : 10 factory(global.moment) 11}(this, (function (moment) { 'use strict'; 12 13 //! moment.js locale configuration 14 15 var units = { 16 ss: 'sekundes_sekundēm_sekunde_sekundes'.split('_'), 17 m: 'minūtes_minūtēm_minūte_minūtes'.split('_'), 18 mm: 'minūtes_minūtēm_minūte_minūtes'.split('_'), 19 h: 'stundas_stundām_stunda_stundas'.split('_'), 20 hh: 'stundas_stundām_stunda_stundas'.split('_'), 21 d: 'dienas_dienām_diena_dienas'.split('_'), 22 dd: 'dienas_dienām_diena_dienas'.split('_'), 23 M: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), 24 MM: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), 25 y: 'gada_gadiem_gads_gadi'.split('_'), 26 yy: 'gada_gadiem_gads_gadi'.split('_'), 27 }; 28 /** 29 * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. 30 */ 31 function format(forms, number, withoutSuffix) { 32 if (withoutSuffix) { 33 // E.g. "21 minūte", "3 minūtes". 34 return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; 35 } else { 36 // E.g. "21 minūtes" as in "pēc 21 minūtes". 37 // E.g. "3 minūtēm" as in "pēc 3 minūtēm". 38 return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; 39 } 40 } 41 function relativeTimeWithPlural(number, withoutSuffix, key) { 42 return number + ' ' + format(units[key], number, withoutSuffix); 43 } 44 function relativeTimeWithSingular(number, withoutSuffix, key) { 45 return format(units[key], number, withoutSuffix); 46 } 47 function relativeSeconds(number, withoutSuffix) { 48 return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; 49 } 50 51 var lv = moment.defineLocale('lv', { 52 months: 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split( 53 '_' 54 ), 55 monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), 56 weekdays: 57 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split( 58 '_' 59 ), 60 weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'), 61 weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'), 62 weekdaysParseExact: true, 63 longDateFormat: { 64 LT: 'HH:mm', 65 LTS: 'HH:mm:ss', 66 L: 'DD.MM.YYYY.', 67 LL: 'YYYY. [gada] D. MMMM', 68 LLL: 'YYYY. [gada] D. MMMM, HH:mm', 69 LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm', 70 }, 71 calendar: { 72 sameDay: '[Šodien pulksten] LT', 73 nextDay: '[Rīt pulksten] LT', 74 nextWeek: 'dddd [pulksten] LT', 75 lastDay: '[Vakar pulksten] LT', 76 lastWeek: '[Pagājušā] dddd [pulksten] LT', 77 sameElse: 'L', 78 }, 79 relativeTime: { 80 future: 'pēc %s', 81 past: 'pirms %s', 82 s: relativeSeconds, 83 ss: relativeTimeWithPlural, 84 m: relativeTimeWithSingular, 85 mm: relativeTimeWithPlural, 86 h: relativeTimeWithSingular, 87 hh: relativeTimeWithPlural, 88 d: relativeTimeWithSingular, 89 dd: relativeTimeWithPlural, 90 M: relativeTimeWithSingular, 91 MM: relativeTimeWithPlural, 92 y: relativeTimeWithSingular, 93 yy: relativeTimeWithPlural, 94 }, 95 dayOfMonthOrdinalParse: /\d{1,2}\./, 96 ordinal: '%d.', 97 week: { 98 dow: 1, // Monday is the first day of the week. 99 doy: 4, // The week that contains Jan 4th is the first week of the year. 100 }, 101 }); 102 103 return lv; 104 105})));