diff --git a/dev-note/bazel.md b/dev-note/bazel.md new file mode 100644 index 0000000..981f0e6 --- /dev/null +++ b/dev-note/bazel.md @@ -0,0 +1,4 @@ +# [bazel](https://bazel.google.cn/?hl=en) +> a fast, scalable, multi-language and extensible build system. + +[github代码](https://github.com/bazelbuild/bazel) diff --git a/html/calendar.mjs b/html/calendar.mjs index 71ee775..6e6f367 100644 --- a/html/calendar.mjs +++ b/html/calendar.mjs @@ -50,6 +50,8 @@ const ChinaDay = ["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d" // ['初','十','廿','卅','闰'] const ChinaElement = ["\u521d","\u5341","\u5eff","\u5345", "\u95f0"] + + // 农历日中文显示,参数日期day export const toChinaDay = function(day) { let str = ''; @@ -93,6 +95,66 @@ export const leapDays = function(year) { return 0; } +/** + * 阳历月份天数 + * 平年2月28天,闰年2月29天 + * 4、6、9、11是30天 + * 1、3、5、7、8、10、12是31天 + * + */ +const SolarMonthDays = [0,31,28,31,30,31,30,60,31,31,30,31,30,31]; +const isSolarLeap = (year) => { + return ((year %4) == 0 && (year%100) !== 0) || (year%100) === 0; +} +/** + * 农历转阳历,算同一年内两个月份的差异,以九月初三为例来说明 + * 阳历 农历 + * x-y 9-3 + * 9-3 7-11 + * + * @param y + * @param m + * @param d + */ +export const lunarToSolar = (y, m, d) => { + // 当年阳历对应的农历 + const solar93 = solarToLunar(y, m, d); + // 当年农历的月份天数 + const months = lunarMonthDays(y); + const dayList = []; + // 对应阳历的农历到目标农历的天数 + // 当月天数 + dayList.push(months[solar93.lunarM] - solar93.lunarD); + for (let i = solar93.lunarM + 1; i < m;i++) { + dayList.push(months[i]); + } + dayList.push(d); + // 因为阳历天数是固定的,算出来 + // 假设的阳历加上这个天数差就是 + let total = dayList.reduce((p,c)=>p+c,0); + let month = m, day = d; + for (let i = m; ;) { + const theMonthDays = SolarMonthDays[i]; + // 第一个月 + if (i === m && theMonthDays - d < total) { + total -= (theMonthDays - d - 1); + i++; + } else { + if (total > theMonthDays) { + total -= theMonthDays; + i++; // 下一个月 + } else { + day = total; + month = i; + break; + } + } + } + return { + month, day + }; +} + // 某年份农历各月天数 export const lunarMonthDays = function(year) { year = year || nowInfo().y; diff --git a/html/personal.html b/html/personal.html index 55a3455..0515123 100644 --- a/html/personal.html +++ b/html/personal.html @@ -23,10 +23,12 @@

生日

- +
+ +
@@ -34,7 +36,7 @@

生日

diff --git a/index/article.md b/index/article.md index fc1e538..3e225ff 100644 --- a/index/article.md +++ b/index/article.md @@ -14,9 +14,11 @@ - [wsl](../dev-note/wsl.md) - [vscode](../dev-note/vscode.md) - [cmd](../dev-note/cmd.md) +- [bazel](../dev-note/bazel.md) - [Mathjax](../articles/mathjax.md) - [app 2023](../articles/2023/app.md) + ### web - [网页开发内容](../web/index.md) - [webassembly](../web/webAssembly.md) diff --git a/index/online.md b/index/online.md index 818ebb8..35cf366 100644 --- a/index/online.md +++ b/index/online.md @@ -33,7 +33,6 @@ ## 工具 - ### 文档 - [PubScholar公益学术平台](https://pubscholar.cn/)