Skip to content

Commit 4b9edec

Browse files
committed
add world calendar support part 1
1 parent 6151575 commit 4b9edec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+664
-233
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
"superscript-text": "^1.0.0",
9090
"tinycolor2": "^1.3.0",
9191
"topojson-client": "^2.1.0",
92-
"webgl-context": "^2.2.0"
92+
"webgl-context": "^2.2.0",
93+
"world-calendars": "0.1.0"
9394
},
9495
"devDependencies": {
9596
"brfs": "^1.4.3",

src/lib/coerce.js

+15
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
'use strict';
1111

12+
var calendarList = Object.keys(require('world-calendars').calendars);
1213
var isNumeric = require('fast-isnumeric');
1314
var tinycolor = require('tinycolor2');
1415

@@ -267,6 +268,20 @@ exports.valObjects = {
267268

268269
return true;
269270
}
271+
},
272+
calendar: {
273+
description: [
274+
'A string, one of the calendar systems available',
275+
'in the `world-calendars` package, to be used in evaluating',
276+
'or displaying date data. Defaults to built-in (Gregorian) dates.',
277+
'available calendars:', '*' + calendarList.join('*, *') + '*'
278+
].join(' '),
279+
requiredOpts: [],
280+
otherOpts: ['dflt'],
281+
coerceFunction: function(v, propOut, dflt) {
282+
if(v && calendarList.indexOf(v) !== -1) propOut.set(v);
283+
else propOut.set(dflt);
284+
}
270285
}
271286
};
272287

0 commit comments

Comments
 (0)