master
Raw Download raw file
 1/*
 2 *
 3 * Date.addLocale(<code>) adds this locale to Sugar.
 4 * To set the locale globally, simply call:
 5 *
 6 * Date.setLocale('da');
 7 *
 8 * var locale = Date.getLocale(<code>) will return this object, which
 9 * can be tweaked to change the behavior of parsing/formatting in the locales.
10 *
11 * locale.addFormat adds a date format (see this file for examples).
12 * Special tokens in the date format will be parsed out into regex tokens:
13 *
14 * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
15 * {unit} is a reference to all units. Output: (day|week|month|...)
16 * {unit3} is a reference to a specific unit. Output: (hour)
17 * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
18 * {unit?} "?" makes that token optional. Output: (day|week|month)?
19 *
20 * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
21 *
22 * All spaces are optional and will be converted to "\s*"
23 *
24 * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
25 * all entries in the modifiers array follow a special format indicated by a colon:
26 *
27 * minute:|s  = minute|minutes
28 * thicke:n|r = thicken|thicker
29 *
30 * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
31 * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
32 *
33 * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
34 *
35 * When matched, the index will be found using:
36 *
37 * units.indexOf(match) % 7;
38 *
39 * Resulting in the correct index with any number of alternates for that entry.
40 *
41 */
42
43Date.addLocale('da', {
44  'plural': true,
45  'months': 'januar,februar,marts,april,maj,juni,juli,august,september,oktober,november,december',
46  'weekdays': 'søndag|sondag,mandag,tirsdag,onsdag,torsdag,fredag,lørdag|lordag',
47  'units': 'millisekund:|er,sekund:|er,minut:|ter,tim:e|er,dag:|e,ug:e|er|en,måned:|er|en+maaned:|er|en,år:||et+aar:||et',
48  'numbers': 'en|et,to,tre,fire,fem,seks,syv,otte,ni,ti',
49  'tokens': 'den,for',
50  'articles': 'den',
51  'short':'d. {d}. {month} {yyyy}',
52  'long': 'den {d}. {month} {yyyy} {H}:{mm}',
53  'full': '{Weekday} den {d}. {month} {yyyy} {H}:{mm}:{ss}',
54  'past': '{num} {unit} {sign}',
55  'future': '{sign} {num} {unit}',
56  'duration': '{num} {unit}',
57  'ampm': 'am,pm',
58  'modifiers': [
59    { 'name': 'day', 'src': 'forgårs|i forgårs|forgaars|i forgaars', 'value': -2 },
60    { 'name': 'day', 'src': 'i går|igår|i gaar|igaar', 'value': -1 },
61    { 'name': 'day', 'src': 'i dag|idag', 'value': 0 },
62    { 'name': 'day', 'src': 'i morgen|imorgen', 'value': 1 },
63    { 'name': 'day', 'src': 'over morgon|overmorgen|i over morgen|i overmorgen|iovermorgen', 'value': 2 },
64    { 'name': 'sign', 'src': 'siden', 'value': -1 },
65    { 'name': 'sign', 'src': 'om', 'value':  1 },
66    { 'name': 'shift', 'src': 'i sidste|sidste', 'value': -1 },
67    { 'name': 'shift', 'src': 'denne', 'value': 0 },
68    { 'name': 'shift', 'src': 'næste|naeste', 'value': 1 }
69  ],
70  'dateParse': [
71    '{num} {unit} {sign}',
72    '{sign} {num} {unit}',
73    '{1?} {num} {unit} {sign}',
74    '{shift} {unit=5-7}'
75  ],
76  'timeParse': [
77    '{0?} {weekday?} {date?} {month} {year}',
78    '{date} {month}',
79    '{shift} {weekday}'
80  ]
81});
82