aardio 文档

aardio 范例: 节日

import console; 
import time.festival;

// 查询今天的节日
var today = time.festival.get();
if(#today.list > 0) {
    for(i, f in today.list) {
        console.log(f.name, f.level);
    }
}

// 只获取重要节日(不包含 4/*_TIME_FESTIVAL_MINOR*/)
var result = time.festival.get("2025-01-01");
console.log("2025-01-01",result)

// 包含所有节日(含民族节日)
var result = time.festival.get("2025-01-01",4/*_TIME_FESTIVAL_MINOR*/);
//console.dumpJson(result)

// 快速获取节日名称
var name = time.festival.getName("2025-10-01");  // "国庆节"
console.log("2025-10-01",name)

// 查询春节日期
var chunJie = time.festival.getDate(2025, "春节");
console.log(chunJie)

// 获取2025年所有节日
var allFestivals = time.festival.getByMonth(2025);

// 添加自定义节日
time.festival.addSolarFestival(5, 20, "公司周年庆", 2/*_TIME_FESTIVAL_IMPORTANT*/);

console.pause();

Markdown 格式