Horoscope periods(運限)
^2.6.2 Fortune-period queries use the configuration and language saved when their chart was generated. Changing global defaults or creating another chart does not affect queries on an existing chart.horoscope() accepts a valid Date object or date string; when omitted, the date defaults to the current time at the call. An explicit time index must be an integer from 0 to 12. Invalid dates or time indices throw errors.Introduction
Fortune periods(運限) in Zi Wei Dou Shu(紫微斗數) include decadal(大限), age(小限), yearly(流年), monthly(流月), daily(流日), hourly(流時), minute-level cycle(流分), second-level cycle(流秒), and other cycles. For the concepts and their uses, see fortune periods(運限). iztro supports decadal(大限), age(小限), yearly(流年), monthly(流月), daily(流日), and hourly(流時). Of these, decadal(大限), yearly(流年), monthly(流月), daily(流日), and hourly(流時) provide transit stars(流曜) and four transformations(四化). Transit stars for monthly(流月), daily(流日), and hourly(流時) have been available since v2.4.4. age(小限) has no independent transit stars; the transformations of age(小限) are calculated from its palace stem(宮干).
Tips
Year and month boundaries for fortune-period stem-and-branch calculations follow the chart’s saved horoscopeDivide configuration; the nominal-age boundary for the annual age period(小限) follows ageDivide.
Classes and analysis methods
Development suggestions
Fortune periods(運限) depend on a chart, so obtain their object from a chart instance instead of constructing one with new. The chart’s horoscope() method returns that object.
import { astro } from "iztro";
const astrolabe = astro.astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN");
const horoscope = astrolabe.horoscope('2023-10-26', 2);After the above code is executed, an instance of FunctionalHoroscope will be returned.
FunctionalHoroscope
implements
IFunctionalHoroscope extends HoroscopeThis class inherits all its properties from Horoscope, and its interface adds methods for analyzing stars in fortune periods.
Interface definition
ts^2.6.1interface IFunctionalHoroscope extends Horoscope { toJSON: () => Horoscope; agePalace: () => FunctionalPalace | undefined; palace: (palaceName: PalaceName, scope: Scope) => FunctionalPalace | undefined; surroundPalaces: (palaceName: PalaceName, scope: Scope) => FunctionalSurpalaces | undefined; hasHoroscopeStars: (palaceName: PalaceName, scope: Scope, horoscopeStar: StarName[]) => boolean; notHaveHoroscopeStars: (palaceName: PalaceName, scope: Scope, horoscope: StarName[]) => boolean; hasOneOfHoroscopeStars: (palaceName: PalaceName, scope: Scope, horoscopeStar: StarName[]) => boolean; hasHoroscopeMutagen: (palaceName: PalaceName, scope: Scope, horoscopeMutagen: Mutagen) => boolean; }palaceNameaccepts palace names in any configured language, regardless of the chart’s output language. For example, a chart output in Chinese can accept the English palace name"soul".Properties
Reference Horoscope
Methods
toJSON() ^2.6.0
Purpose
Converts the functional fortune-period object to a plain JSON object. Analysis methods and runtime references to its chart are excluded; circular references are safely ignored.
Definition
tstype toJSON = () => Horoscope;Parameters
None
Return value
Example
tsimport { astro } from "iztro"; const astrolabe = astro.bySolar("2000-8-16", 2, "女"); const data = astrolabe.horoscope("2023-8-19").toJSON();
agePalace() v1.3.0
Purpose
Retrieves the palace occupied by
age(小限).Definition
tstype agePalace: () => FunctionalPalace | undefined;Parameters
None
Return value
FunctionalPalace|undefinedExample
tsimport { astro } from "iztro"; const astrolabe = astro .astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN"); const agePalace = astrolabe .horoscope('2023-10-26', 2) .agePalace();
palace() v1.3.0
Purpose
Retrieves the requested palace for the selected fortune period(運限).
Definition
tstype palace = ( palaceName: PalaceName, scope: Scope ) => FunctionalPalace | undefined;Parameters
Parameter Type Required? Default value Description palaceName PalaceNametrue- Palace name(宮位名稱) scope Scopetrue- Horoscope-period name(運限名稱) Return value
FunctionalPalace|undefinedExample
For
decadal(大限), retrieve thespouse(夫妻) palace.tsimport { astro } from "iztro"; const astrolabe = astro .astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN"); const spousePalace = astrolabe .horoscope('2023-10-26', 2) .palace("夫妻", "decadal");
surroundPalaces() ^1.3.0
Purpose
Retrieves the selected fortune-period palace, its two trine palaces, and its opposite palace(三方四正).
Definition
tstype surroundPalaces = ( palaceName: PalaceName, scope: Scope ) => FunctionalSurpalaces | undefined;Parameters
Parameter Type Required? Default value Description palaceName PalaceNametrue- Palace name(宮位名稱) scope Scopetrue- Horoscope-period name(運限名稱) Return value
FunctionalSurpalaces|undefinedExample
Retrieves
annual spouse palace(流年夫妻宮) together with its two trine palaces and its opposite palace(三方四正).tsimport { astro } from "iztro"; const astrolabe = astro .astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN"); const surpalaces = astrolabe .horoscope('2023-10-26', 2) .surroundPalaces("夫妻", "yearly");
hasHoroscopeStars() ^1.3.0
Purpose
Checks transit stars(流曜) in the specified horoscope-period palace. Returns true only if all specified stars are present.
Definition
tstype hasHoroscopeStars = ( palaceName: PalaceName, scope: Scope, horoscopeStar: StarName[] ) => boolean;Parameters
Parameter Type Required? Default value Description palaceName PalaceNametrue- Palace name(宮位名稱) scope Scopetrue- Horoscope-period name(運限名稱) horoscopeStar StarName[]true- Array of transit stars(流曜) Return value
booleanExample
Checks whether
annual spouse palace(流年夫妻宮) contains bothcheerful(Y)(流喜) andartist(Y)(流曲).tsimport { astro } from "iztro"; const astrolabe = astro .astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN"); const flag = astrolabe .horoscope('2023-10-26', 2) .hasHoroscopeStars("夫妻", "yearly", ["流喜", "流曲"]);
notHaveHoroscopeStars() ^1.3.2
Purpose
Returns true only if none of the specified transit stars(流曜) is present in that horoscope-period palace.
Definition
tstype notHaveHoroscopeStars = ( palaceName: PalaceName, scope: Scope, horoscope: StarName[] ) => boolean;Parameters
Parameter Type Required? Default value Description palaceName PalaceNametrue- Palace name(宮位名稱) scope Scopetrue- Horoscope-period name(運限名稱) horoscopeStar StarName[]true- Array of transit stars(流曜) Return value
booleanExample
Checks whether
annual spouse palace(流年夫妻宮) contains neithercheerful(Y)(流喜) norartist(Y)(流曲).tsimport { astro } from "iztro"; const astrolabe = astro .astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN"); const flag = astrolabe .horoscope('2023-10-26', 2) .notHaveHoroscopeStars("夫妻", "yearly", ["流喜", "流曲"]);
hasOneOfHoroscopeStars() ^1.3.3
Purpose
Checks the specified horoscope-period palace and returns true if at least one specified transit star(流曜) is present.
Definition
tstype hasOneOfHoroscopeStars= (palaceName: PalaceName, scope: Scope, horoscopeStar: StarName[]) => boolean;Parameters
Parameter Type Required? Default value Description palaceName PalaceNametrue- Palace name(宮位名稱) scope Scopetrue- Horoscope-period name(運限名稱) horoscopeStar StarName[]true- Array of transit stars(流曜) Return value
booleanExample
Checks whether
annual spouse palace(流年夫妻宮) contains at least one ofcheerful(Y)(流喜) andartist(Y)(流曲).tsimport { astro } from "iztro"; const astrolabe = astro .astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN"); const flag = astrolabe .horoscope('2023-10-26', 2) .hasOneOfHoroscopeStars("夫妻", "yearly", ["流喜", "流曲"]);
hasHoroscopeMutagen() ^1.3.4
Purpose
Checks whether the specified transformation(四化) for the selected fortune period(運限) occurs in the requested palace.
Definition
tstype hasHoroscopeMutagen = (palaceName: PalaceName, scope: Scope, horoscopeMutagen: Mutagen) => boolean;Parameters
Parameter Type Required? Default value Description palaceName PalaceNametrue- Palace name(宮位名稱) scope Scopetrue- Horoscope-period name(運限名稱) horoscopeMutagen Mutagentrue- four transformations(四化) Return value
booleanExample
Checks whether
annual spouse palace(流年夫妻宮) containsA(化祿).tsimport { astro } from "iztro"; const astrolabe = astro .astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN"); const flag = astrolabe .horoscope('2023-10-26', 2) .hasHoroscopeMutagen("夫妻", "yearly", "禄");