@reykjavik/webtools 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +2 -1
- package/esm/fixIcelandicLocale.privates.js +22 -6
- package/fixIcelandicLocale.privates.js +22 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -479,7 +479,8 @@ detection test.)
|
|
|
479
479
|
- For `timeZoneName` the values `"long"`, `"shortGeneric"` and `"longGeneric"`
|
|
480
480
|
will appear in Danish.
|
|
481
481
|
- The `timeStyle: 'full'` option prints the timezone names in Danish
|
|
482
|
-
- The `dayPeriod` option
|
|
482
|
+
- The `dayPeriod` option has a couple of slight mismatches, at 5 am and 12
|
|
483
|
+
noon.
|
|
483
484
|
|
|
484
485
|
---
|
|
485
486
|
|
|
@@ -128,11 +128,22 @@ const weekdays = {
|
|
|
128
128
|
lør: 'laugardagur',
|
|
129
129
|
søn: 'sunnudagur',
|
|
130
130
|
};
|
|
131
|
+
const dayPeriods = {
|
|
132
|
+
AM: ['f.h.'],
|
|
133
|
+
PM: ['e.h.'],
|
|
134
|
+
'om natten': ['að nóttu', 'n.'],
|
|
135
|
+
// Mismatch at 05:00 — da: 'om morgenen', is: 'að nóttu'
|
|
136
|
+
'om morgenen': ['að morgni', 'mrg.'],
|
|
137
|
+
'om formiddagen': ['að morgni', 'mrg.'],
|
|
138
|
+
// Mismatch at 12:00 — da: 'om eftermiddagen', is: 'hádegi'
|
|
139
|
+
'om eftermiddagen': ['síðdegis', 'sd.'],
|
|
140
|
+
'om aftenen': ['að kvöldi', 'kv.'],
|
|
141
|
+
};
|
|
131
142
|
const partMappers = {
|
|
132
143
|
month: (value) => {
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
return value.endsWith('.') ? `${
|
|
144
|
+
const isl = months[value.slice(0, 3)];
|
|
145
|
+
if (isl) {
|
|
146
|
+
return value.endsWith('.') ? `${isl.slice(0, 3)}.` : isl;
|
|
136
147
|
}
|
|
137
148
|
},
|
|
138
149
|
weekday: (value) => {
|
|
@@ -150,8 +161,12 @@ const partMappers = {
|
|
|
150
161
|
: 'eftir Krist';
|
|
151
162
|
}
|
|
152
163
|
},
|
|
153
|
-
dayPeriod: (value) => {
|
|
154
|
-
|
|
164
|
+
dayPeriod: (value, _, options) => {
|
|
165
|
+
const isl = dayPeriods[value];
|
|
166
|
+
if (isl) {
|
|
167
|
+
const [long, narrow] = isl;
|
|
168
|
+
return options.dayPeriod === 'narrow' ? narrow : long;
|
|
169
|
+
}
|
|
155
170
|
},
|
|
156
171
|
literal: (value, lastType) => {
|
|
157
172
|
if (value === ' den ') {
|
|
@@ -166,10 +181,11 @@ const reformatDateTimeParts = function (parts) {
|
|
|
166
181
|
if (!this.mapped) {
|
|
167
182
|
return parts;
|
|
168
183
|
}
|
|
184
|
+
const options = this.super.resolvedOptions();
|
|
169
185
|
parts.forEach((part, idx) => {
|
|
170
186
|
var _a;
|
|
171
187
|
const mapper = partMappers[part.type];
|
|
172
|
-
const newValue = mapper && mapper(part.value, (_a = parts[idx - 1]) === null || _a === void 0 ? void 0 : _a.type);
|
|
188
|
+
const newValue = mapper && mapper(part.value, (_a = parts[idx - 1]) === null || _a === void 0 ? void 0 : _a.type, options);
|
|
173
189
|
if (newValue != null) {
|
|
174
190
|
part.value = newValue;
|
|
175
191
|
}
|
|
@@ -133,11 +133,22 @@ const weekdays = {
|
|
|
133
133
|
lør: 'laugardagur',
|
|
134
134
|
søn: 'sunnudagur',
|
|
135
135
|
};
|
|
136
|
+
const dayPeriods = {
|
|
137
|
+
AM: ['f.h.'],
|
|
138
|
+
PM: ['e.h.'],
|
|
139
|
+
'om natten': ['að nóttu', 'n.'],
|
|
140
|
+
// Mismatch at 05:00 — da: 'om morgenen', is: 'að nóttu'
|
|
141
|
+
'om morgenen': ['að morgni', 'mrg.'],
|
|
142
|
+
'om formiddagen': ['að morgni', 'mrg.'],
|
|
143
|
+
// Mismatch at 12:00 — da: 'om eftermiddagen', is: 'hádegi'
|
|
144
|
+
'om eftermiddagen': ['síðdegis', 'sd.'],
|
|
145
|
+
'om aftenen': ['að kvöldi', 'kv.'],
|
|
146
|
+
};
|
|
136
147
|
const partMappers = {
|
|
137
148
|
month: (value) => {
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
return value.endsWith('.') ? `${
|
|
149
|
+
const isl = months[value.slice(0, 3)];
|
|
150
|
+
if (isl) {
|
|
151
|
+
return value.endsWith('.') ? `${isl.slice(0, 3)}.` : isl;
|
|
141
152
|
}
|
|
142
153
|
},
|
|
143
154
|
weekday: (value) => {
|
|
@@ -155,8 +166,12 @@ const partMappers = {
|
|
|
155
166
|
: 'eftir Krist';
|
|
156
167
|
}
|
|
157
168
|
},
|
|
158
|
-
dayPeriod: (value) => {
|
|
159
|
-
|
|
169
|
+
dayPeriod: (value, _, options) => {
|
|
170
|
+
const isl = dayPeriods[value];
|
|
171
|
+
if (isl) {
|
|
172
|
+
const [long, narrow] = isl;
|
|
173
|
+
return options.dayPeriod === 'narrow' ? narrow : long;
|
|
174
|
+
}
|
|
160
175
|
},
|
|
161
176
|
literal: (value, lastType) => {
|
|
162
177
|
if (value === ' den ') {
|
|
@@ -171,10 +186,11 @@ const reformatDateTimeParts = function (parts) {
|
|
|
171
186
|
if (!this.mapped) {
|
|
172
187
|
return parts;
|
|
173
188
|
}
|
|
189
|
+
const options = this.super.resolvedOptions();
|
|
174
190
|
parts.forEach((part, idx) => {
|
|
175
191
|
var _a;
|
|
176
192
|
const mapper = partMappers[part.type];
|
|
177
|
-
const newValue = mapper && mapper(part.value, (_a = parts[idx - 1]) === null || _a === void 0 ? void 0 : _a.type);
|
|
193
|
+
const newValue = mapper && mapper(part.value, (_a = parts[idx - 1]) === null || _a === void 0 ? void 0 : _a.type, options);
|
|
178
194
|
if (newValue != null) {
|
|
179
195
|
part.value = newValue;
|
|
180
196
|
}
|
package/package.json
CHANGED