ただし、javascriptなので、C#では、そのままでは、動作しません。そこで、
次のように、オフラインで、2035年までJSONを吐かせてそれをファイルとして搭載することにしました。
#!/usr/bin/env node
/**
* draw tree of supported countries, states, regions
*/
function country_draw(stream,hd,country,country_name,state,state_name,region,region_name){
hd.init(country)
var holidays=hd.getHolidays(2015)
for (y=2016;y< 2035 -="" 10="" 1="" :="" console.dir="" console.log="" const="" countries="" countrieslen="" country="" country_code="" country_name="" d="" date-holidays="" date="" draw="[" dt.getdate="" dt.getmonth="" dt="new" else="" for="" foreach="" function="" hd="new" holiday.substitute="" holiday.type="=" holiday="" holidays1="hd.getHolidays(y)" holidays="" i="" if="" m="" maxarraylength:="" maxarraylength="" msec="" n="" null="" object.keys="" of="" ountries:="" public="" public_holidays.push="" public_holidays="" region="" region_code="" region_name="" slice="" state="" state_code="" state_name="" str="" stream="" substitute_holidays.push="" substitute_holidays="" t="" tree="" util.inspect="" util="" var="" y="dt.getFullYear();"> {
const d = (i === countriesLen ? draw[1] : draw[0])
//console.log(d + country + ': ' + countries[country] + '\n')
const hd = new Holidays()
if (i!=0) console.log(",");
country_draw(stream,hd,country,countries[country],"","","","")
const states = Holidays().getStates(country)
if (states) {
const statesLen = Object.keys(states).length - 1
Object.keys(states).forEach((state, j) => {
let d = (i === countriesLen ? draw[3] : draw[2])
d += (j === statesLen ? draw[1] : draw[0])
//console.log(d + state + ': ' + states[state] + '\n')
console.log(",");
country_draw(stream,hd,country,countries[country],state,states[state],"","")
const regions = Holidays().getRegions(country, state)
if (regions) {
const regionsLen = Object.keys(regions).length - 1
Object.keys(regions).forEach((region, k) => {
let d = (i === countriesLen ? draw[3] : draw[2])
d += (j === statesLen ? draw[3] : draw[2])
d += (k === regionsLen ? draw[1] : draw[0])
//console.log(d + region + ': ' + regions[region] + '\n')
console.log(",");
country_draw(stream,hd,country,countries[country],state,states[state],region,regions[region])
})
}
})
}
})
}
module.exports = tree
if (module === require.main) {
console.log("{'members':[\n")
tree(process.stdout)
console.log("]\n")
console.log("}\n")
}
定義済み曜日の祝をクリックするとComboboxが出現します。国だけではなくて、米国のようにState、さらにRegionまで必要な場合もあるんですね。

0 件のコメント:
コメントを投稿