UNPKG

3.5 kBJavaScriptView Raw
1//! moment.js locale configuration
2//! locale : Spanish [es]
3//! author : Julio Napurí : https://github.com/julionc
4
5import moment from '../moment';
6
7var monthsShortDot =
8 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
9 '_'
10 ),
11 monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
12 monthsParse = [
13 /^ene/i,
14 /^feb/i,
15 /^mar/i,
16 /^abr/i,
17 /^may/i,
18 /^jun/i,
19 /^jul/i,
20 /^ago/i,
21 /^sep/i,
22 /^oct/i,
23 /^nov/i,
24 /^dic/i,
25 ],
26 monthsRegex =
27 /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
28
29export default moment.defineLocale('es', {
30 months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
31 '_'
32 ),
33 monthsShort: function (m, format) {
34 if (!m) {
35 return monthsShortDot;
36 } else if (/-MMM-/.test(format)) {
37 return monthsShort[m.month()];
38 } else {
39 return monthsShortDot[m.month()];
40 }
41 },
42 monthsRegex: monthsRegex,
43 monthsShortRegex: monthsRegex,
44 monthsStrictRegex:
45 /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
46 monthsShortStrictRegex:
47 /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
48 monthsParse: monthsParse,
49 longMonthsParse: monthsParse,
50 shortMonthsParse: monthsParse,
51 weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
52 weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
53 weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
54 weekdaysParseExact: true,
55 longDateFormat: {
56 LT: 'H:mm',
57 LTS: 'H:mm:ss',
58 L: 'DD/MM/YYYY',
59 LL: 'D [de] MMMM [de] YYYY',
60 LLL: 'D [de] MMMM [de] YYYY H:mm',
61 LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',
62 },
63 calendar: {
64 sameDay: function () {
65 return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
66 },
67 nextDay: function () {
68 return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
69 },
70 nextWeek: function () {
71 return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
72 },
73 lastDay: function () {
74 return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
75 },
76 lastWeek: function () {
77 return (
78 '[el] dddd [pasado a la' +
79 (this.hours() !== 1 ? 's' : '') +
80 '] LT'
81 );
82 },
83 sameElse: 'L',
84 },
85 relativeTime: {
86 future: 'en %s',
87 past: 'hace %s',
88 s: 'unos segundos',
89 ss: '%d segundos',
90 m: 'un minuto',
91 mm: '%d minutos',
92 h: 'una hora',
93 hh: '%d horas',
94 d: 'un día',
95 dd: '%d días',
96 w: 'una semana',
97 ww: '%d semanas',
98 M: 'un mes',
99 MM: '%d meses',
100 y: 'un año',
101 yy: '%d años',
102 },
103 dayOfMonthOrdinalParse: /\d{1,2}º/,
104 ordinal: '%dº',
105 week: {
106 dow: 1, // Monday is the first day of the week.
107 doy: 4, // The week that contains Jan 4th is the first week of the year.
108 },
109 invalidDate: 'Fecha inválida',
110});