lunar-lite
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -29,3 +29,3 @@ "use strict"; | ||
.reduce(function (prev, next) { return prev.concat(next); }, []) | ||
.map(function (item) { return +item; }); | ||
.map(function (item) { return Math.abs(+item); }); | ||
}; | ||
@@ -32,0 +32,0 @@ exports.normalizeDateStr = normalizeDateStr; |
@@ -15,3 +15,3 @@ "use strict"; | ||
var getHeavenlyStemAndEarthlyBranchByLunarDate = function (dateStr, timeIndex, isLeap, options) { | ||
if (options === void 0) { options = { year: 'normal' }; } | ||
if (options === void 0) { options = { year: "normal" }; } | ||
var solarDate = (0, convertor_1.lunar2solar)(dateStr, isLeap); | ||
@@ -29,8 +29,12 @@ return (0, exports.getHeavenlyStemAndEarthlyBranchBySolarDate)(solarDate.toString(), timeIndex, options); | ||
var getHeavenlyStemAndEarthlyBranchBySolarDate = function (dateStr, timeIndex, options) { | ||
if (options === void 0) { options = { year: 'exact' }; } | ||
if (options === void 0) { options = { year: "exact" }; } | ||
var _a = (0, convertor_1.normalizeDateStr)(dateStr), year = _a[0], month = _a[1], date = _a[2]; | ||
var solar = lunar_typescript_1.Solar.fromYmdHms(year, month, date, Math.max(timeIndex * 2 - 1, 0), 30, 0); | ||
var lunar = solar.getLunar(); | ||
var yearlyGan = (options === null || options === void 0 ? void 0 : options.year) === 'normal' ? lunar.getYearGan() : lunar.getYearGanByLiChun(); | ||
var yearlyZhi = (options === null || options === void 0 ? void 0 : options.year) === 'normal' ? lunar.getYearZhi() : lunar.getYearZhiByLiChun(); | ||
var yearlyGan = (options === null || options === void 0 ? void 0 : options.year) === "normal" | ||
? lunar.getYearGan() | ||
: lunar.getYearGanByLiChun(); | ||
var yearlyZhi = (options === null || options === void 0 ? void 0 : options.year) === "normal" | ||
? lunar.getYearZhi() | ||
: lunar.getYearZhiByLiChun(); | ||
var yearly = [ | ||
@@ -37,0 +41,0 @@ yearlyGan, |
@@ -95,3 +95,3 @@ import { EARTHLY_BRANCHES, HEAVENLY_STEMS } from "./constants"; | ||
/** exact:立春分界,normal:除夕分界 */ | ||
year: 'exact' | 'normal'; | ||
year: "exact" | "normal"; | ||
}; |
{ | ||
"name": "lunar-lite", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "精简版的农历和阳历日期转换库。", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25905
601