@karinjs/moment
Version:
Parse, validate, manipulate, and display dates
146 lines (145 loc) • 3.97 kB
JavaScript
import hooks from "../moment.js";
//! moment.js locale configuration
//! locale : Slovak [sk]
//! author : Martin Minka : https://github.com/k2s
//! based on work of petrbela : https://github.com/petrbela
var months = "január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split(
"_"
), monthsShort = "jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");
function plural(n) {
return n > 1 && n < 5;
}
function translate(number, withoutSuffix, key, isFuture) {
var result = number + " ";
switch (key) {
case "s":
return withoutSuffix || isFuture ? "pár sekúnd" : "pár sekundami";
case "ss":
if (withoutSuffix || isFuture) {
return result + (plural(number) ? "sekundy" : "sekúnd");
} else {
return result + "sekundami";
}
case "m":
return withoutSuffix ? "minúta" : isFuture ? "minútu" : "minútou";
case "mm":
if (withoutSuffix || isFuture) {
return result + (plural(number) ? "minúty" : "minút");
} else {
return result + "minútami";
}
case "h":
return withoutSuffix ? "hodina" : isFuture ? "hodinu" : "hodinou";
case "hh":
if (withoutSuffix || isFuture) {
return result + (plural(number) ? "hodiny" : "hodín");
} else {
return result + "hodinami";
}
case "d":
return withoutSuffix || isFuture ? "deň" : "dňom";
case "dd":
if (withoutSuffix || isFuture) {
return result + (plural(number) ? "dni" : "dní");
} else {
return result + "dňami";
}
case "M":
return withoutSuffix || isFuture ? "mesiac" : "mesiacom";
case "MM":
if (withoutSuffix || isFuture) {
return result + (plural(number) ? "mesiace" : "mesiacov");
} else {
return result + "mesiacmi";
}
case "y":
return withoutSuffix || isFuture ? "rok" : "rokom";
case "yy":
if (withoutSuffix || isFuture) {
return result + (plural(number) ? "roky" : "rokov");
} else {
return result + "rokmi";
}
}
}
const sk = hooks.defineLocale("sk", {
months,
monthsShort,
weekdays: "nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),
weekdaysShort: "ne_po_ut_st_št_pi_so".split("_"),
weekdaysMin: "ne_po_ut_st_št_pi_so".split("_"),
longDateFormat: {
LT: "H:mm",
LTS: "H:mm:ss",
L: "DD.MM.YYYY",
LL: "D. MMMM YYYY",
LLL: "D. MMMM YYYY H:mm",
LLLL: "dddd D. MMMM YYYY H:mm"
},
calendar: {
sameDay: "[dnes o] LT",
nextDay: "[zajtra o] LT",
nextWeek: function() {
switch (this.day()) {
case 0:
return "[v nedeľu o] LT";
case 1:
case 2:
return "[v] dddd [o] LT";
case 3:
return "[v stredu o] LT";
case 4:
return "[vo štvrtok o] LT";
case 5:
return "[v piatok o] LT";
case 6:
return "[v sobotu o] LT";
}
},
lastDay: "[včera o] LT",
lastWeek: function() {
switch (this.day()) {
case 0:
return "[minulú nedeľu o] LT";
case 1:
case 2:
return "[minulý] dddd [o] LT";
case 3:
return "[minulú stredu o] LT";
case 4:
case 5:
return "[minulý] dddd [o] LT";
case 6:
return "[minulú sobotu o] LT";
}
},
sameElse: "L"
},
relativeTime: {
future: "za %s",
past: "pred %s",
s: translate,
ss: translate,
m: translate,
mm: translate,
h: translate,
hh: translate,
d: translate,
dd: translate,
M: translate,
MM: translate,
y: translate,
yy: translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal: "%d.",
week: {
dow: 1,
// Monday is the first day of the week.
doy: 4
// The week that contains Jan 4th is the first week of the year.
}
});
export {
sk as default
};