From a9a3fbc7b918b7e0d134b266d487f69523897837 Mon Sep 17 00:00:00 2001 From: 6tail <6tail@6tail.cn> Date: Tue, 9 Jul 2024 13:28:45 +0800 Subject: [PATCH] =?UTF-8?q?v1.1.0=20=E6=9B=B4=E6=94=B9=E4=BA=86getYear()?= =?UTF-8?q?=E3=80=81getMonth()=E3=80=81getDay()=E7=9A=84=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E9=9D=9E=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9B=E6=96=B0=E5=A2=9E=E5=90=89=E7=A5=9E?= =?UTF-8?q?=E5=AE=9C=E8=B6=8B=E3=80=81=E5=87=B6=E7=A5=9E=E5=AE=9C=E5=BF=8C?= =?UTF-8?q?=EF=BC=9B=E6=96=B0=E5=A2=9E=E6=AF=8F=E6=97=A5=E5=AE=9C=E5=BF=8C?= =?UTF-8?q?=E3=80=81=E6=97=B6=E8=BE=B0=E5=AE=9C=E5=BF=8C=EF=BC=9B=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9A=E5=86=9C=E5=8E=86=E6=97=A5=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=97=B6=E8=BE=B0=E5=88=97=E8=A1=A8=E9=81=87=E9=97=B0=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 + lib/index.ts | 514 +++++++++++++++++++++++++++++------------ package.json | 2 +- test/EightCharTest.ts | 8 +- test/GodTest.ts | 94 ++++++++ test/LunarDayTest.ts | 8 +- test/LunarMonthTest.ts | 40 ++-- test/SolarDayTest.ts | 4 +- test/TabooTest.ts | 77 ++++++ 9 files changed, 571 insertions(+), 182 deletions(-) create mode 100644 test/GodTest.ts create mode 100644 test/TabooTest.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7faa27e..fe6f7dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,3 +18,9 @@ 2. 新增:六曜。 3. 新增:入梅出梅。 4. 新增:获取农历日当天的时辰列表。 + +## [1.1.0] - 2024-07-09 +1. 注意:此版本更改了getYear()、getMonth()、getDay()的返回类型,非兼容性更新。 +2. 新增:吉神宜趋、凶神宜忌。 +3. 新增:每日宜忌、时辰宜忌。 +4. 修复:农历日获取时辰列表遇闰月报错的问题。 diff --git a/lib/index.ts b/lib/index.ts index 442d9d1..f9d7834 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -429,6 +429,61 @@ export class Element extends LoopTyme { } } +export class God extends LoopTyme { + static NAMES: string[] = ['天恩', '鸣吠', '母仓', '不将', '四相', '鸣吠对', '五合', '三合', '除神', '月德', '月空', '月德合', '月恩', '时阴', '五富', '生气', '金匮', '相日', '阴德', '六合', '益后', '青龙', '续世', '明堂', '王日', '要安', '官日', '吉期', '福德', '六仪', '金堂', '宝光', '民日', '临日', '天马', '敬安', '普护', '驿马', '天后', '阳德', '天喜', '天医', '司命', '圣心', '玉宇', '守日', '时德', '解神', '时阳', '天仓', '天巫', '玉堂', '福生', '天德', '天德合', '天愿', '天赦', '天符', '阴神', '解除', '五虚', '五离', '重日', '复日', '血支', '天贼', '土符', '游祸', '白虎', '小耗', '致死', '河魁', '劫煞', '月煞', '月建', '往亡', '大时', '大败', '咸池', '厌对', '招摇', '九坎', '九焦', '天罡', '死神', '月害', '死气', '月破', '大耗', '天牢', '元武', '月厌', '月虚', '归忌', '小时', '天刑', '朱雀', '九空', '天吏', '地火', '四击', '大煞', '勾陈', '八专', '灾煞', '天火', '血忌', '土府', '月刑', '触水龙', '地囊', '八风', '四废', '四忌', '四穷', '五墓', '阴错', '四耗', '阳错', '孤辰', '小会', '大会', '八龙', '七鸟', '九虎', '六蛇', '天狗', '行狠', '了戾', '岁薄', '逐阵', '三丧', '三阴', '阴道冲阳', '阴位', '阴阳交破', '阴阳俱错', '阴阳击冲', '鬼哭', '单阴', '绝阴', '纯阳', '阳错阴冲', '七符', '成日', '孤阳', '绝阳', '纯阴', '大退', '四离', '阳破阴冲']; + + protected static dayGods: string[] = [ + ';000002300F14156869717A3F;01001617495C40413C425D6A;0209000C041831031906054A5E6B4B5F;033500041A1B032C06054C4D4E60;04002D321C1D1E104F50615152;05111F53546C55433C3E;062E200721220D01566E44;070B2333242F45;08360A2526242F080157583D59;091234080162463C3D5A;0A270728292A5B6364653F79;0B0237130E2B4748727A3E66;0C09020C04300F0314150568696D;0D3504031617495C40413C6F425D6A;0E38183119064A5E6B4B5F;0F001A1B032C064C4D4E60;10002D321C1D1E104F50615152;110B00111F53546C55433C3E;12360A002E200721220D015644;13002333456D;142526242F080157583F3D59;15001234080162463C3D5A;16090004270728292A5B636465;17350204130E032B47483E66;1802300F14156869;19031617495C40413C425D6A;1A1831031906054A5E6B4B5F;1B0B1A1B032C06054C4D4E;1C360A2D321C1D1E104F50615152;1D111F53546C55433C3E;1E2E200721220D01563F44;1F23334573;20090C042526242F080157583D;2135041234080162463C3D5A;22270728292A5B636465;2302130E032B47483E66;2402300F0314150568696E;250B031617495C40413C425D6A;26360A18311906054A5E6B4B5F;271A1B2C06054C4D4E60;282D321C1D1E104F506151523F;29111F53546C55433C3E;2A090C042E200721220D015644;2B350423334567;2C2526242F0857583D59;2D001234080162463C3D5A;2E00270728292A5B63646574;2F0B0002130E032B47483E66;30360A0002300F141505686975;31001617495C40413C425D6A676D;3218311906054A5E6B4B3F675F76;331A1B2C06054C4D4E60;34090C042D321C1D1E104F50615152;353504111F53546C55433C6F3E;362E200721220D5644;3723334567;382526242F08015758703D6759;390B123408016246703C3D5A84;3A360A270728292A5B636465;3B02130E2B47483E66;', + ';00090002272A536C4C4D4E41717A;0100300F3103233C6151523F66;020004180E032406150543405D;03000C041A1D340617054A5E6B4F50;04002D1B555F;050B112526321C2B3C42654B3E60;060A2E2014100547546246;0712070D161F566A;0822192F0148453D44;092C083301575868695B633C3D;0A0937131E495C6459;0B020721282903727A3F3E5A;0C020427032A05536C4C4D4E416D;0D0C04300F03233C6F61515266;0E38180E24061543405D;0F0B001A1D3406174A5E6B4F5078;100A002D1B555F;1100112526321C2B3C42654B3E60;12002E2014100147546246;130012070D161F566A6D;140922192F080148453D44;152C083301575868695B633C3F3D44;160413031E495C6459;17020C0407212829033E5A;1802272A536C4C4D4E41;190B300F3103233C61515266;1A0A180E032406150543405D;1B1A1D340617014A5E6B4F50;1C2D1B555F;1D112526321C2B3C42654B3E60;1E092E2014100147546246;1F12070D161F56736E6A3F;200422192F080148453D44;210C042C083301575868695B633C3D;22131E495C6459;230B0207212829033E5A;240A0227032A05536C4C4D4E41;25300F31233C61515266;26180E2406150543405D;271A1D340617054A5E6B4F50;28092D1B555F;29112526321C2B3C42654B3F3E60;2A042E2014100147546246;2B0C0412070D161F566A67;2C22192F0848453D44;2D0B002C083301575868695B633C3D85;2E0A0013031E495C6459;2F0002072128293E5A;300002272A05536C4C4D4E4175;3100300F31233C6151526E676D66;3209180E2406150543405D;331A1D340617054A5E6B4F503F76;34042D1B555F;350C04112526321C2B3C6F42654B3E60;362E20141047546246;370B12070D161F566A67;380A22192F08014845703D6744;392C083301575868695B63703C3D74;3A131E495C6459;3B02072128293E5A;', + ';00000207282931032B717A6E5D59;01000314473C5A;020A000427182526300F1D16062A054F506A;03360B00041A1906055562464066;04002D2C154A5E6B6C733F788B;0512111B0E1E17483C3E;060C2E20321C016869655F;0753544960;08350907210D230810015B63564B3D77;091324081F014C4D4E453C423D;0A2203342F57586461515244;0B02032C4341727A3E;0C0A020407282931032B055D6D59;0D360B040314473C6F5A;0E3827182526300F1D16062A4F506A3F;0F001A19065562464066;10000C2D2C154A5E6B6C86;110012111B0E1E17483C3E;123509002E20321C0168696E655F;13005354495C6D60;1407210D230810015B63564B3D7F;1537130324081F014C4D4E453C423D;160A042203342F57586461515244;17360B0204033343413E;1802072829312B5D3F59;190314473C5A;1A0C27182526300F1D16062A054F506A;1B1A1906055562464066;1C35092D2C154A5E6B6C;1D12111B0E1E17483C3E;1E2E20321C016869655F;1F5354495C60;200A0407210D230810015B63564B3D80;21360B04130324081F014C4D4E453C423D;2222342F5758646151523F44;2302033343413E;24020C072829312B055D59;2514473C5A;26120927182526300F1D16062A054F506A;271A1906055562464066;282D2C154A5E6B6C76;2912111B0E1E17483C3E;2A0A042E20321C016869655F;2B360B045354495C6760;2C07210D2308105B63564B3F3D77;2D00130324081F014C4D4E453C423D;2E000C22342F57586461515244;2F00023343413E;3035090002072829312B05755D59;310014473C676D5A;3227182526300F1D16062A054F506A67;331A1906055562464066;340A042D2C154A5E6B6C;35360B0412111B0E1E17483C6F3E;362E20321C6869653F5F;375354495C6760;380C07210D230810015B6356704B3D677774;391324081F014C4D4E45703C423D;3A350922342F57586461515244;3B023343413E;', + ';000A00220362463C44;010B00072128291D334F50645D;02360002230605534855423F59;03000212300F24060568695A;0400042E27342A495C403C8C;050C04184A5E6B3E66788D76;06091A1B2B15014C4D4E;07352D321C14175B636151526577;0811130E16080147546C433C6A3D5F;0920070D190801563D60;0A0A032C2F104541;0B0B252631031E1F57584B3E;0C362203056246717B3C3F6D44;0D072128291D334F50645D;0E020423065348554259;0F00020C0412300F240668696E5A;1009002E12342A495C403C;113500184A5E6B3E66;12001A1B2B15014C4D4E;13002D321C14175B63615152656D77;140A11130E0316080147546C433C6F6A3D5F;150B20070D03190801563D60;1636032C2F104541733F;17252631031E1F5758727B4B3E;1804220362463C44;190C04072128291D334F50645D;1A09022306055348554259;1B3502120D0F24060568695A;1C2E27342A495C403C;1D184A5E6B3E66;1E0A381A1B2B15014C4D4E;1F0B2D321C14175B63615152657F;20363711130E0316080147546C433C6A3F3D5F;2120070D03190801563D60;2204032C2F104541;230C042526311E1F57584B3E;2409220562463C44;2535072128291D334F50645D;26022306055348554259;270212300F24060568695A;280A2E27342A495C403C6F;290B184A5E6B3E66;2A361A1B2B15014C4D4E3F81;2B2D321C14175B6361515265678074;2C0411130E03160847546C433C6A3D5F;2D000C0420070D190801566E3D60;2E09002C2F104541;2F35002526311E1F57584B3E;300022056246703C44;3100072128291D334F50645D676D;320A02230605534855426759;330B02120D0F2406056869755A;34362E27342A495C403C3F;35184A5E6B3E6676;36041A1B2B154C4D4E81;370C042D321C14175B6361515265677774;380911130E16080147546C433C6A3D675F;393520070D190801563D60;3A2C2F104541;3B2526311E1F5758704B3E87;', + ';00001D2F10575868694F503C;0100122B1F495C5564;0209000207222829140605655D44;03000216063305474C4D4E51526A4B3F;04000C042E300F193C6159;0504182C43403E5A;06271A1E2A014A5E6B6C5B6342;070B2D1B1366;080A112526321C0815013C3D;0920032308170153546246413D;0A07210D310324565F;0B0E033448453E60;0C091D2F1005575868694F50717B3C6D;0D122B1F495C553F;0E020C04072228291406655D44;0F000204160633474C4D4E51526A4B;10002E300F193C6159;110B00182C43403E5A;120A00271A1E2A014A5E6B6C5B6342;13002D1B13036D66;14112526321C030815013C6F3D;1520032308170153546246413D;160907210D31032456735F;170E344845727B3F3E60;180C041D2F10575868694F503C;1904122B1F495C5564;1A0207222829140605655D44;1B0B0216063305474C4D4E51526A4B;1C0A2E300F193C6159;1D182C43403E5A;1E38271A1E2A014A5E6B6C5B6342;1F2D1B130366;2009112526321C030815013C3D;21202308170153546246413F3D;220C0407210D3103565F;23040E3448453E60;241D2F1005575868694F503C;250B122B1F495C5564;260A0207222829140605655D44;270216063305474C4D4E51526A4B;282E300F193C6F616E59;29182C43403E5A;2A09271A1E2A014A5E6B6C5B63427988;2B372D1B133F6766;2C0C04112526321C0308153C3D;2D0004202308170153546246413D;2E0007210D3124565F;2F0B000E3448453E60;300A001D2F1005575868694F50703C89;3100122B1F495C5564676D;320207222829140605655D6744;330216063305474C4D4E7551526A4B;34092E300F193C6159;35182C43403F3E5A;360904271A1E2A4A5E6B6C5B634278;37042D1B136766;38112526321C0815013C3D67;390B202308170153546246413D;3A0A07210D3124566E5F;3B0E03344845703E60;', + ';003509001E2F554C4D4E453C51525D5F;010057586C646160;0200020E06100543;0300020721282923061F0565;0400042E2224533C7344;05360B04182526300F34335B633F3E74;060A1A13016246404B59;070C2D2B4A5E6B5A;0827111B0314082A0148413C3D;0920321C310316080148413C3D;0A35090319154754495C42;0B12070D1D2C174F50563E;0C1E2F05554C4D4E45717B3C51525D6D5F;0D57586C646160;0E02040E061043;0F360B0002040721282923061F653F;100A002E2224533C44;11000C182526300F34335B633E;12001A1303016246404B59;13002D032B4A5E6B6D5A;14350927111B0314082A0148413C6F3D;1520321C310316080168696A3D66;1619154754495C426E;1712070D1D2C174F5056727B3E;18041E2F554C4D4E453C51525D5F;19360B0457586C64613F60;1A0A020E06100543;1B020C0721282923061F0565;1C2E2224533C44;1D182526300F34335B633E;1E3509381A1303016246404B59;1F2D032B4A5E6B5A;2027111B14082A0148413C3D;2120321C3116080168696A3D66;22040319154754495C42;23360B0412070D1D2C174F50563F3E;240A1E2F05554C4D4E453C51525D5F;250C57586C646160;26020E06100543;27020721282923061F0565;2835092E2224533C6F44;29182526300F34335B633E;2A1A13016246404B5982;2B2D2B4A5E6B675A76;2C0427111B0314082A48413C3D;2D360B000420321C3116080168696A3F3D66;2E0A0019154754495C42;2F000C12070D1D2C174F50563E;30001E2F05554C4D4E45703C51525D5F;310057586C6461676D608E;323509020E0610054367;33020721282923061F057565;342E2224533C6E44;35182526300F34335B633E7974;3637041A13036246404B5982;37360B042D2B4A5E6B3F675A76;380A27111B14082A0148413C3D67;390C20321C3116080168696A3D66;3A0319154754495C42;3B12070D1D2C174F5056703E;', + ';0000302007210D341556;01000217455D;020A0025262B2F060557586C5F;030B001406056246603C8F;0436000207282916105B6364656A;0537130E191F47483E;0622300F2C0168693F44;07021E33495C40413C;08090C04184A5E423D59;093504121A1B0308014C4D4E51524B3D5A;0A02272D321C1D232A4F507E61;0B1124535455433E66;0C0A2E2007210D341505566D;0D0B0217455D;0E3625262B2F0657586C;0F00140662463C4260;10000207282916105B6364656A3F79;1100130E191F47483E;1209350C0422300F032C01686944;1335000204031E33495C40413C6D;1418310308014A5E6B3D59;15121A1B0308014C4D4E51524B3D5A;160B1124535455433C6F6E3E66;17362E2007210D341556;180217455D;1925262B060557586C3F5F;1A14060562463C4260;1B09020C0407282916105B6364656A;1C3504130E03191F47483E;1D22300F032C01686944;1E02031E495C40413C;1F0A183108014A5E6B3D59;200B121A1B08014C4D4E51524B3D5A;213602272D321C1D232A4F507E61;221124535455433C3E66;232E2007210D34150556717C3F;24021745735D;25090C0425262B2F060557586C5F;26350414060562463C4260;270207282916105B6364656A74;28130E03191F47483E;290A22300F2C01686944;2A0B021E33495C40413C6F67;2B36381831034A5E6B3D59;2C00121A1B08014C4D4E51524B3D5A;2D0002272D321C1D232A4F507E613F;2E00112453545543727C3C3E66;2F09000C042E2007210D34150556;303500020417455D676D;3125262B2F060557586C70675F;321406056246703C426084;330A0207282916105B6364656A;340B130E191F47486E3E;353622300F032C7544;36021E33495C40413C67;37183108014A5E6B3F3D675976;38121A1B08014C4D4E51524B3D5A;3909020C04272D321C1D232A4F507E61;3A35041124535455433C3E66;3B0A002E27202C2A475462464B;', + ';000B0002070D1E5666;01002F06150548456E5D;0200061705575868695B633C;030002130323495C645F;0407212829249060;0509341001534C4D4E415152;060212300F31031F3C61423F;070418220E032B080143403D44;080C041A1D14080833014A5E6B6C4F503D;090A022D1B16556A59;0A0B112526321C193C653E5A;0B2E27202C2A05475462464B6D;0C02070D1E5666;0D2F061548455D;0E000617575868695B633C85;0F090002371323495C645F;10000721282903243F3E60;11000403341001534C4D4E415152;1200020C0412300F31031F3C61426D;130A18220E032B080143403D44;140B1A1D140833014A5E6B6C4F503D;15022D1B16556A59;16112526321C193C6F653E5A;172E27202C2A475462464B;1802070D1E5666;19092F06150548455D;1A061705575868695B633C3F79;1B0204130323495C645F;1C0C040721282903243E60;1D0A03341001534C4D4E415152;1E0B0227300F311F3C6142;1F18220E2B080143406E3D44;201A1D140833014A5E6B6C4F503D;210A02272D321C1D232A4F507E61;22022D1B16556A59;23112526321C193C653E5A;24092E27202C2A0547546246717C4B;2502070D1E56733F66;26042F06150548455D;270C04061705575868695B633C;280A02130323495C645F;290B07212829243E60;2A341001534C4D4E415152;2B0212300F311F3C6F614267;2C3818220E032B0843403D44;2D001A1D140833014A5E6B5B4F503D78;2E0900022D1B16556A59;2F00112526321C19727C3C653F3E5A;3000042E27202C2A05475462464B;3100020C04070D1E56676D66;320A2F0615054845705D67;330B061705575868695B63703C74;34021323495C645F;3507212829243E60;36033410534C4D4E41755152;370212300F311F3C614267;380918220E2B080143403D6744;391A1D140833014A5E6B6C4F503F3D76;3A02042D1B16556A59;3B0C04112526321C193C653E5A;', + ';00002E20391C246869655D59;010002345354495C5A;023509002707210D062A055B6356515277;0300132B06054C4D4E453C66;04000203142F1557586473614B3F;0512161743416A3E;060C072829310319015F;07360B02032C476C3C6E60;080A04182526300F1D1E0810014F503D;09041A081F01556246403D;0A022D224A5E6B4486;0B111B0E2333483C423E;0C35092E20321C24056869655D6D59;0D02345354495C5A;0E2707210D062A5B635651523F77;0F00132B064C4D4E453C66;1000020C03142F15575864614B;11360B001203161743416A3E;120A0004072829310319015F;13000204032C476C3C6D60;14182526300F1D1E0810014F503D;151A081F01556246403D;163509022D224A5E6B44;17111B0E2333483C6F423E;182E20321C246869655D3F59;1902345354495C5A;1A0C2707210D062A055B635651527F;1B360B3713032B06054C4D4E453C66;1C0A020403142F15575864614B;1D041203161743416A3E;1E0728293119015F;1F022C476C3C60;203509182526300F1D1E08104F503D;211A081F01556246403D;22022D224A5E6B3F447891;23111B0E2333483C423E;240C2E20321C24056869717C655D59;25360B021C5354495C6E5A;260A042707210D062A055B6356515280;270413032B06054C4D4E453C66;2802142F15575864614B;2912161743416A3E;2A35090728293119015F;2B022C476C3C6F6760;2C38182526300F1D1E08104F503F3D;2D001A081F01556246403D;2E0002092D224A5E6B4476;2F360B00111B0E233348727C3C423E;300A00042E20321C24056869655D59;31000204345354495C676D5A;322707210D062A055B6356705152677774;33132B06054C4D4E45703C66;34350902142F15575864614B;3512161743416A3E;36072829310319753F5F;37022C476C3C6760;380C182526300F1D1E0810014F503D67;39360B1A081F01556246403D;3A0A02042D224A5E6B44;3B04111B0E2333483C423E;', + ';00090038041A221B194C4D4E44;0135000C042D321C2C335B6361655D77;02002E11130E1E06054754433C59;03001220070D0605565A;0400272F2A454142;050B252631032357583E66;06360A0324150162463C;07072128291D34174F50644B;080208015348553F3D5F;0902300F2B080168693D60;0A09041410495C403C6F;0B35090418161F4A5E6B6C5152403E;0C1A221B19054C4D4E6D44;0D2D321C2C335B6361655D77;0E2E11130E1E064754433C6E59;0F0B351220070D0306565A;10360A0027032F2A454142;1100252631032357583E66;12000324150162463C3F;1300072128291D34174F50644B6D;1409020408015348553D5F;1535020C04300F2B080168693D60;161410495C403C;1718161F4A5E6B6C51526A3E;181A221B194C4D4E4481;190B0A2E11130E031E06054754433C59;1A360A2E11130E031E06054754433C59;1B1220070D030605565A;1C27032F2A454173423F;1D252631032357583E66;1E090424150162463C;1F350C04072128291D34174F50644B;200208015348553D5F;2102300F2B080168693D60;221410495C403C92;230B18161F4A5E6B6C51526A3E7893;24360A1A221B19054C4D4E44;252D321C2C335B6361655D7F;26372E11130E031E06054754433C3F59;271220070D030605565A;280904272F2A454142;29350C042526312357583E66;2A2415016246703C;2B072128291D34174F50644B67;2C02085348556E3D5F;2D090002300F2B080168693D60;2E360A001410495C403C;2F0018161F4A5E6B6C51526A3E;30001A221B19054C4D4E717D3F4481;31002D321C2C335B6361655D676D8074;3209042E11130E1E06054754433C6F6759;33350C042720070D0605565A;34272F2A454142;35252631235758703E6687;36241562463C;370B072128291D34174F50644B67;38360A023A015348553D675F;3902300F2B08016869753D60;3A1410495C403C3F;3B18161F4A5E6B6C727D51526A3E76;', + ';0000380C041A23104A5E6B5B63;010004122D1B13241F838A;020A002E11252622321C3406053C5D44;030B00200306330553544641;040007210D312B5659;050E031448453E5A;060E1D162F2A01575868694F503C6A;0719495C556466;0809020728292C081501515242653D;09021E081701474C4D4E3F3D;0A0C04300F3C6F614B5F;0B041843403E60;0C0A1A2310054A5E6B5B636D;0D0B122D1B1303241F838A94;0E2E11252622321C34063C5D44;0F002003063353546C624641;100007210D31032B5659;11000E031448453E5A;120900271D162F2A01575868694F503C6A;130019495C55643F6D66;14020C040728292C081501515242653D;1502041E081701474C4D4E3D;160A300F3C614B5F;170B1843403E60;181A23104A456B5B6378;19122D1B1303241F9583;1A2E11252622321C033406053C5D44;1B200306330553546C6246416E;1C0907210D31032B567359;1D0E1448453F3E5A;1E0C04271D163B2A01575868694F503C6A;1F0419495C556466;200A020728292C081501515242653D;210B021E081701474C4D4E3D;22300F3C614B5F;231843403E60;241A2310054A5E425B63;25122D1B1303241F;26092E11252622321C033406053C5D44;272006330553546C6246413F;280C0407210D312B5659;29040E1448453E5A;2A0A271D162F2A01575868694F50703C6A89;2B0B19495C55646766;2C020728292C0815515242653D;2D00021E081701474C4D4E3D;2E00300F3C614B5F;2F001843403E60;3009001A2310054A5E6B5B63717D7988;310037122D1B13241F3F676D;320C042E11252622321C3406053C6F5D6744;33042006330553546C624641;340A07210D312B5659;350B0E03144845703E5A;36271D162F2A575868694F503C6A;3719495C55646766;38020728292C081501515242653D67;39021E081701474C4D4E756E3D;3A09300F3C614B5F;3B184340727D3F3E60;', + ';000A003837041A1316624640425D6A5F;01360B00042D194A5E6B4B60;020009111B032C06100548413C;030020321C310310061F056869;0400224754495C7344;05070D1D334F505651523F3E;063509232F01554C4D4E453C59;070C24575864615A;0802270E34082A01433D;09020721282908016E653D66;0A0A042B15536C3C6F;0B360B0412182526300F14175B633E;0C1A13031605624640425D6A6D5F;0D2D03194A5E6B4B60;0E2E111B33061048413C;0F0020321C31031E061F68693F;1035090022034754495C44;11000C070D1D334F505651523E;1200232F01554C4D4E453C59;130024575864616D5A;140A0204270E0F082A01433D;15360B0204072128290801653D66;162B15536C3C;17121825260D0F14175B633E;181A1316624640425D6A5F82;192D03194A5E6B4B3F60;1A35092E111B032C061048413C;1B0C20321C31031E061F056869;1C224754495C44;1D07121D334F505651523E;1E0A04232F01554C4D4E453C59;1F360B0424575864615A;2002270E34082A01433D;2102072128290801653D66;222B15536C3C;2312182526300F14175B633F3E;2435091A13031605624640425D6A5F;250C2D03194A5E6B4B60;262E111B2C06100548413C;2720321C311E061F056869;280A04224746495C44;29360B04070D1D334F505651523E;2A232F01554C4D4E45703C59;2B2457586461675A96;2C02270E34082A433D;2D0002072128290801653F3D66;2E3509002B15536C3C;2F000C12182526300F14175B633E;30001A1316624640717D425D6A5F82;31002D194A5E6B4B676D6076;320A042E111B2C06100548413C6F67;33360B0420321C311E061F0568696E;3422034754495C44;35070D1D334F50567051523E;36232F554C4D4E453C59;3724575864613F675A;38350902270E34082A01433D67;39020C07212829080175653D66;3A2B15536C3C;3B12182526300F14175B63727D3E7974;' + ]; + + protected constructor(indexOfName: number | string) { + super(God.NAMES, indexOfName); + } + + static fromIndex(index: number): God { + return new God(index); + } + + static fromName(name: string): God { + return new God(name); + } + + next(n: number): God { + return God.fromIndex(this.nextIndex(n)); + } + + getLuck(): Luck { + return Luck.fromIndex(this.index < 60 ? 0 : 1); + } + + static getDayGods(month: SixtyCycle, day: SixtyCycle): God[] { + const l: God[] = []; + let index: string = day.getIndex().toString(16).toUpperCase(); + if (index.length < 2) { + index = '0' + index; + } + const matcher: RegExpExecArray | null = new RegExp(`;${index}(.[^;]*)`, 'g').exec(God.dayGods[month.getEarthBranch().next(-2).getIndex()]); + if (matcher) { + const data: string = matcher[1]; + for (let i: number = 0, j: number = data.length; i < j; i += 2) { + l.push(God.fromIndex(parseInt(data.substring(i, i + 2), 16))); + } + } + return l; + } +} + export class Phase extends LoopTyme { static NAMES: string[] = ['朔月', '既朔月', '蛾眉新月', '蛾眉新月', '蛾眉月', '夕月', '上弦月', '上弦月', '九夜月', '宵月', '宵月', '宵月', '渐盈凸月', '小望月', '望月', '既望月', '立待月', '居待月', '寝待月', '更待月', '渐亏凸月', '下弦月', '下弦月', '有明月', '有明月', '蛾眉残月', '蛾眉残月', '残月', '晓月', '晦月']; @@ -489,6 +544,92 @@ export class Sound extends LoopTyme { } } +export class Taboo extends LoopTyme { + static NAMES: string[] = ['祭祀', '祈福', '求嗣', '开光', '塑绘', '齐醮', '斋醮', '沐浴', '酬神', '造庙', '祀灶', '焚香', '谢土', '出火', '雕刻', '嫁娶', '订婚', '纳采', '问名', '纳婿', '归宁', '安床', '合帐', '冠笄', '订盟', '进人口', '裁衣', '挽面', '开容', '修坟', '启钻', '破土', '安葬', '立碑', '成服', '除服', '开生坟', '合寿木', '入殓', '移柩', '普渡', '入宅', '安香', '安门', '修造', '起基', '动土', '上梁', '竖柱', '开井开池', '作陂放水', '拆卸', '破屋', '坏垣', '补垣', '伐木做梁', '作灶', '解除', '开柱眼', '穿屏扇架', '盖屋合脊', '开厕', '造仓', '塞穴', '平治道涂', '造桥', '作厕', '筑堤', '开池', '伐木', '开渠', '掘井', '扫舍', '放水', '造屋', '合脊', '造畜稠', '修门', '定磉', '作梁', '修饰垣墙', '架马', '开市', '挂匾', '纳财', '求财', '开仓', '买车', '置产', '雇庸', '出货财', '安机械', '造车器', '经络', '酝酿', '作染', '鼓铸', '造船', '割蜜', '栽种', '取渔', '结网', '牧养', '安碓磑', '习艺', '入学', '理发', '探病', '见贵', '乘船', '渡水', '针灸', '出行', '移徙', '分居', '剃头', '整手足甲', '纳畜', '捕捉', '畋猎', '教牛马', '会亲友', '赴任', '求医', '治病', '词讼', '起基动土', '破屋坏垣', '盖屋', '造仓库', '立券交易', '交易', '立券', '安机', '会友', '求医疗病', '诸事不宜', '馀事勿取', '行丧', '断蚁', '归岫']; + + protected static dayTaboo: string[] = [ + '8319000776262322200C1E1D,06292C2E1F;0F11185C0001092A0D7014692983847B7C2C2E302F802D2B,06454F208A;111852838470795B302F404533802D152B39201E23221D212726,0F2E1F010D29;004023222089,0F29111847;11180001032A0D70795B2C2E302F802D4E152B33714161201F26,52095847;0F17000102061979454F3A15477677,241F8A20;34357C89,7129;1551000403706A454F3A3D771F262322271E1D21,382B415220;0F000102037039297175261F1D21,454F2E156341;00076A54196348767765,7920297115528A0D382B;11180001020439332C2E302F2B5844477515634C1F2721,0F520D19267A29717020;297170192C2E2D2F2B3E363F4C,0F5215632001034720;4C78,297172380D2A2E0F474841;18115C0001702A2C2E2F5283847129795B6375802D154C,1F208A24;1811795B032C2E302F802D4163754C27261E1D2120,010D0F29521F;00401D232289,71290F4720;0F170001020E032A70692C2E302F802D2B0D7129474C201F2322,5211183809615D;0F1811000102062A0D2C2D804B2B672E2F7129,70471F8A20;0007343589,0F71296B7080;175447440D15838477656A49,2B2E1F8A2022;11187129705B79000106032A0D397B6F7C802D2C2B61756627261E0C1D21,0F2E154147;0007385476771548,52061F20;0106111839513A2C2E2D2F8C804B4723221F63,71522920;1118000717161A2C2E3371292B56433D6375363F,0F010347208A;161A7889,292E1F0F3861;11180F00012A0D70795D7B7C39332D2C2E4E4863664C,064F478A20;5452838479195D00012A0D7B7C2C2E3348156366242526201E,0F7129;00262789,292C2E1F2B2F;040318111A17332C15290D200C7A,47450638;0004031A170F11332C2E302F1571292A657677451949,70201D52;007B343589,88;00010670175B71292A152322271E,03637C2B38;04067033392C7161262322271E1D210C,;000715547776,521F;181100012C2E2F1F,0F38;70076A363F,2920;7889,292E1F;0F707B7C00012F75,5220;528403395B2F1E20,0F01;4089,88;02060418110D332C2E415B637566262322271F20,520F;0F181100012C2E7129,5220;7C343589,88;0001020603691817452C2E2D498344,412B6A096338;393589,88;076A48,45752F29384C0F204F612B;000301394F2E154763751F27,0F707A802629710D1920;4F2C2E2B383F443D433663,0F01478A2015;201E27262322,89;0F000102700D335283845329711563,38048A7D4520;6A0339332C20528384531563,29713801000F0C47806B;005089,88;291503000D332E53261F2075,0F5238584F45;003989,88;3435000789,88;150001021745512E443D65262322,2B63387C;394889,88;00036A7415384878,45751F20240F522E834F;00010203332C2E2F1558631F,0F1920707A29712646;0717363F1A2C4F3A67433D8B,71290F010347;', + '0007010618111A332D302F15262322271E530270164C,560F7129;003989,88;073918111A17332C2E71292322271F1E20481D45548384,38002F70;700F181126151E20001A7919,;5040262789,0F712903;7911192C2E302F00030401060F1571292A75,707C2052;0079701811072C2E01060F33152627200C7A1A302F4576631F2B,80523829;39343589,88;040370181123220F1326271E2021,2915;262322271E202189,1F45;0001060403232226380F767754,56802015;0070071A010618110F5B52846775,632620;00010607155B5C26271E2021165D83,38470F29;3948007889,;528384530339454F0D297115332E2F637520,0F007058;5283845444360F11756415,2C2F29016B472E2B2038;0039504089,;0F0001022E792D3E75663D19,472063703852292B;0F000102032971152C2E19,4720637038522B;343589,88;0F52838403700D332C29712E1F27201E2322,15450175;00261F23221E201D2189,;003989,88;52838454754C2971150301022E,0F63206A0938268A41;151A83842627202322,580F7003632E1F297C;00394C786F89,0F2E4420;0704031118528384542D2E4E49201F1E1D2127,292B000C;0F706A151E201D528384544466,47010C2E292F2C38;394089,71294709636F7C44;0F0003450D3329712C2E2F1575,528A63705A20587D7C;0F111829711500010370390D332E750C201F,4552832F382B80;0034353989,522E1F;0F1118032A0D545283841A802D2C2E2B71296366774744201F26232221,010900150C;0006261F1E201D212322,0F29381118;0006547677,0F5229151F20;111800010206071979697C67474475664C,0F16298A20;000102071283542627201D210C4C78,29580F2E6352032E1F;00784C793989,0F29702E1F208A;0F03390D332C1929711563261D2E2322,382000521118750C706B;702D155483840F63262720,53292F017D4F38442B2E1F47;4089,030F565A61206B;0F181179005B712980152D4E2A0D533358,5270208A;0776776A742623221F200C211D1E,11180F2F5206802B;00343589,060F52;07565A5283845463756677261F20,010F152961;0007363F8B3989,09292C208A0F;0F11181200171A7919547638,5215201D;181179000607040D03302F5283844F3A45512B1533664C47,090F702E208A;838454151A4C200C1E23221D212726,030F522E1F;0039787989,1F2E20;111871545283842979397B7C69152B2A0D33485324251F1D1E26,6B00702F800C20;0F18110001027939706954528384685D15565A75201E1D26,29032E;00170F79191A6540,712909387C20;00676589,0F20;0F00071A706A717677492923221E202726,80522E1F;343589,0F5220;111800020D041A796933483E5347446563751F1D212026,010F09150C;262322271E201D21,52450F4F;0038262389,5215;040307177938494C,0F262070;', + '0F00030102705283842E544779,2920454F754C38;00010275261E0C2322,6303706F0F292E1F;033945302F838475262720,297071000F2E1F38;000102030F7039453319152E2D2F63751F0C1E20,71290D3847;7917155B0001025D,0F522E3820;38394089,0001202B;0F00175058,5D6B80382E;110F0001702C2E7129201F,5206;0007396A48343589,0F20;111800012A0D2C705271292E201F,15386179;3F656477,0F2B712920;11000170792C2E7129,0F52201F;110F00017052792E1F1E,71290D2B20;0001020626232227201E,0F2E03801F;1179302F842627201E,0071292E1F;0001067052842E71291F20,030F384775;79026A17657603,522E201F;004089,0F014720;010206110F452C2E7129095B5226232227201F0C,58804B036B2B38;69687011180F791966762627201E,0352292E80;00077B7C4834353989,295220;00170F332C2E2D2F802952443F26232227201F,15637C38;006526232227201F,89;0403010218111A17332C2E2D2B15713E6575,4538206429;0007030401021811171A0F2E2322271F1E706749528483,202F2938;000102081A158483262322270C1E,700F292E;1A162623227954,0001710F29;00061A161718110F292A0C26271F21797001022F49,47;1516291211020056,063820;3840,0001202B89;0403080618111A16332E2F152A09537919702C5445490D75072B,80632038;0001081811171A160F1571292A26271E20396476452B0D,632E5238;7B34,88;010206040318110F2E292A27200C70072C302F541F392B49,3815;64262322271F2021,0F2F2938;0002070818111A16175B153E445D5452848365647576,2038454F;000701020618111A1752848354230C7027,26203829;000102261E2027,03476F700F2971382E;15391A302F83845475662627201E,0F702E46290047;0F150370002E0D3979528384532971331F1E20,477D;0F0302791566046F,29710D722A38528384202E45;383940,6370018A75202B454F66;3907,88;0F000170390D332E2971152F63751F1E20,52846A38;00397C343548,89;000102030D70332C2E29712F534426201F1E,0F3815;6526232227201F,88;7100030170391959152E2D2F2B,0F201F4F75668A38;0F030102392E15634447001F1E,293845200D7075;00161A5D454F153826201E27,7D0D29;1A454F548384,88;0F00010203700D332E2F1929711552838453261F201E2322,;0F171170792F5B1566770001032C2B802D,29387C2071;50400089,88;5C11180001027170520D2984832B15200C,03802E3863;2E260F27201F,523815292F1A;7B7C343589,520F;00060724232227261F2025,520F157929382F;003F651F0C2027232289,0F29;00076A386563,0F7D8A2066454F52754C;', + '00077663,0F29713820;000304080618110F1A2E2D0D3371292A2C302F7566010239454E802B,6320;181117332C2E1526232227201F1E3E,38030F5229;0103040818111A155284262322271E20217A79708330,38472E63;00483F,6338200F;03041A174533302F56795B3E808339528454,700F2920;17262322274050,80387C6B;000F01111A1615292A2627200C2C670279538384543E49,6345;00010618111A16332C2E2F2D27200C07483A450D,15528438;34357B7C,88;002E2F18110F5B3315292A26271F20210C7A70710102393E19,035A;000304111A33152D2E302F71292A5284530770022B,0F634520;1A16170F13152654,3852204F;0018112C2E01040607332D292A09270C2322696870302F47023945,38205280;18111A16175B3315262322271F1E201D215D838454433E363F754551,00030F29;00700F1715262720,472E3863;3F88,2B38200F;030402111A16175B4F3A2B153E0079015D54528483696A51,7006200F;000F1320,63803829;0079181A165B332F2B262322271E2021030469702D4E49712930845D,454F;00030401061A16170F332E71292627200C02696A45514F0D2C2D4E497A,2B;007C343589,88;0F00701784831952712C2E1526271F,03380620;52848353000103297115332E2F19,0F8A514F6A66207545;6A170F19,5845754C201F4F3824;0F000301020D297115332E1F0C,16522026;1545332C2E2F84836375662620,0F0003700D71292B;000102060F17705283797823221E2027,2E7129;3F74397677658988,0F384720;5452848303152F802C2D,2E1F208A7A700F29710C7D;00010F17505840,565A803852838463;0F00030102700D19297115332C2B535448,2E45208A;0F03000102700D29713963451F0C20,528338542F158061;34357B7C89,030F;118384155B20272E1F21,0F0338;0001020607036A5D397C2163664744,0F4E25208A;5483846376656419786A,29803020;0F18110001702C2E71291F0D2B152F2127,52831620;1784832C2E5B26201F,0F010D29;00797084831754,0F2E472D4E1F;000739483F66,0F208A2B;54528384036F796A153E65,712963;0F17795B54838458,52807C38;0F5C111800015B712952841F20,756A25;01067071292C2E1F20,1103150F52;343589,0F715229;0F170070792C2E261F,0403412322;03027011170D332D2C2E2F716152838454,010F201F;6A170F1963766F,5452201F;030102703945802D2C512B7129092322270C7566,112E5283;1A5D453A332C2E2F4B25262322271F201E1D21,000F7047;007984831A160F1719,632E20471D6B;483F89,88;040318111A16175B795452848315302F6563395D,38702920;000F1323222627,2E38290315;010203040618110F3315292A271D200C6339171A712C2E30491E21,7A;0039262322271E201D210C0748766465776A,150F3829;3435,88;007018111A1617192E15382627201F656477,4F09;00030418111617332E2D2F292A52845407020D302B,090F4520;', + '528384530003010215392C20,1112180F29560D2E1F7545;004D64547589,0F29;2A0D11180F52848353037039156358332C2E,38200026;00702C2E164C157126271F1E202425363F,29386A032B;005089,032C2E1F;0F00010206030D7129302F79802D7C2B5C4744,11701D20528438;000403110F527079156523221E2027,0129802E1F6B;00384089,15296763;000102060775261F20,71290F7015;1100010206702D804E2B2620,0F52540D;0007397B7C343589,01065220;0776776564,000F293820;00010206111803302F565A802D4E2B881F261E0C,0D0F52;00763989,0F20;110F70528475660D7129,012E1F2026;0001020617385483,030F47202B6B;0039787089,2E1F8A034F206B;0706397B7C794C636A48,520F71294720;02703918110F7919155283756626232227201E,012C2E1F0C;00384089,0F202E157C;5C0001020652835B0E03804B2D4E2B752024210C,292E565A;000103020611187B7C2D4E616439201E0C26,522E4744;000734357B7C3989,0F52832920;88,;0004031811171A5B332C2E155D52,0D292045;0089,090F15;18110F197983842E230C271F1E7A70525463,26202915;00011A1615262322271F1E200C214C,472B0F11;00190F153917701A48,472E1F2003;11037B7C2E2F7129,0F5220;007952151E20,0F2E1F;00384740,0F20;0006522E261F20,0F7129;0F11000170717B,522E1F;007B7C3989,88;076564,0F2920;,88;393589,88;0F03700D33195284835329711563,01260038206B;0F70161715232238838426271F20,7D0352;70504C7889,88;0001030239450D297115332C2E4C,0F54207052843863;110F03706A795215636626271E,0C012F38062C292B;0040395089,88;000103392E54837548,19700F58157A2038;00010203390D3329152C2B751E20,2E1F544753524583;0039343589,88;3F4889,88;000102033911170D3319152E2F0947442627201F,;393489,88;0F0102037039330D5284832971152E1F0C,0026206B;001A1715838444363F261F1E200C2322,0F476B520363;0070784889,0345201F;000102031118396375664819,1D413870208029;0370833F0F6A5215,010D582E1F202C2F5829;00387765504089,0F157C;070039201F0C2789,06030F292F;003926271E20747677642322480C06,2E1F;00073934357B7C89,0F52;073F7765644889,0120;', + '0F110001702E2F71291F20,06;110001527B7C2E75,0F20;0F11707129,2E1F20;1811002E1F8384,0F20;0F1A0070153871291F20,7A76;3F6589,88;0F1811700001062E2F1F20,7129;18117915384C,5220;07404826271F1E2089,88;0F00010203700D332E2F192971152B52838453631F20,;00037039041A26271F1E202322,0F2F2C335129452E0D3A;0039343589,88;0F0001020370332E2F0D19297115637566302B2C3979,;528384000103451915332C2E631F2720,29716A0D0F70;653989,88;0F00010203528384157033,752971206B452F2B262E;0F000102700D332C2E297115383F631F20,034756;394889,88;528384530370331929272E2B2F631F1D20,0F156B38;1979,3F2F2E45207D;074048261F202322,0F71454F15000180;0F000102030D70332E3919528384532971152B2F201F0C,;0001020339161745514F2C190F1A152E2D2F304979,;3435073989,88;11180F5C000102030D332C2E195329711563261F202322,5284;5283840001032E1570637566302F391F,0F47297120;39701117302F713819297566,004551152C2E201D1F;0001020370528384631575712D2E4E3E581F1E1D,292C2B45262080;0F83843D363F776424,15462F2C5203297115;3F8B657789,0F2029702E7D;11180F0001020339700D29716375662E1F2620,38155680;03111A171538193E3F,0F632C2E70454F200C;110F1A6A702C2E1952838453712F6375,4520150001;5283845300010670802D2C2E4E155B201F1E232221,380F71296A;0F1118000102030D70332E2C192971153953631F0C262720,52846125;000739343589,0320;18110F3900010203700D3329711563752E1F0C201D,38525D;000102031811392E2D19528384543E4463751F20,152F1A290F;00657689,6B0F52;0001020311180F702E1F7952838468332D6749443E46630C1E1D21,292B20;0F1700707129385C363F3D1F1E232226,80412B202F;00398B7989,0F20;0F111800017C5C2C2E7129,5270153820;0F1118795B65170002195D,52382E8A20;0007711F204840,010F291538;000106025B75712904032D302F382B2A0D801E20,2E1F0F0F;0F1118060300017B7C792E39767566261F20,71298051;000739343589,8A20;074889,06520F38;5283845B79037B7C802D2C2E4E302F2B38493D4463664C1F2021,0F0D7129;63767789,522E0006206B;0F00010206181139702E1F686F6A792D2C304E153375664923221D21,52296B0D80;89,;3F8B6589,1F20;0370110F45510D3371290941614C522623222720,;1966583F6589,88;03700F,79192C2E2D715275262322271F201D2179;0F11700001522E71291F20,2B;0F117B7C2C2E71291F20,5203;00343589,88;', + '00343589,7129565A;00060403702C2E4C154947443D651F,0D29;528384530339332E152C2F58631F20,380D000F29;006589,29704720;0F1118175C000301027039450D29332C2E2F15631F,8A5820;0F161A17452F0D33712C2E2B5443633F,150170208A03;70786289,06802E1F;0F0001020370390D332C1929712E157563548384534C,20248A;5B000102073911522C302F3A678C363F33490D482425200C1E2322,0F15382E1F61;00076A74504089,5229702C7D;0F110001708471292E1F20,0338805156;111817000106702C2E71292A0D33802D302F4E2B44,0F522520;0007343589,290F71;0F5B8370000102060403161A494447,386A418A20;11177B7C52842C2E5B1F20,060071292F0F;003889,52201F1D47;000102062A397129797B7C2E1F2425,162F5D2026;0F172C2E387129363F7566512D4E4461,0103475220;008354,06462F2E1F;0F181117795B5C007054292A0D690403332D2C2E66632B3D,8A454F38;030270170F45513A2C71295283842A0D532D24252623222720,155A382E1F;00076A0F3874485040,06707C25;5B71297000010611182A0D39792C2E332D4E80151F202621,52454F38;00077665776489,52830F208A;34357B7C7789,0F29;0F705B0004037C5D15653F1F26,522B4738;181179190E332C2E2D52637566262322271F20,;0076645089,88;0F1100017B7C702E7129,522B;1A38712975,0F20;0026271E20,2F2E1F;18117001061579,712920;0F11707B7C5271291E20,2E1F;0F00074850,8A20;0F1811705200012E71291F20,38;18117000012C2E7129,5220;88,;0F18110001261F20,0352;037B7C2E2F261F20,0F;006389,88;0F030001027039452971150D332C2F6327,20528384;020F11161A17454F2C2E2D302F2B38434C,20700163;003989,88;0F00010D0302703352838453297115632E,208A454F;03027039450D332C2F2D2971528384636626202322,5815;006A5040077448,702B2C0F2F29;0F00030102700D332E2C192971155383846375261F1E20,;0001020370450D332C2E2D152971,0F52838A201D;343589,88;52838454443D65002C2E15495D1F,0F417D712B3863;528384546315332C2E2F26201F2322,0F0D45002971756B;003889,88;393589,88;2C2E2D2B156343364C,0F4729710D708A20036A19;00788B89,0671292E;11180F000152548471702C2E2D4E303348492A156144474C63,8A201F384506;0F0300017039712952542D2C302F80380D2A363F3349483E616320,1118150C1F2E;0F006A385040740717,1F7063;0F1118000102030D70332C2E192971158384535426201E2322,471F;77766564000789,0F52201E8A;', + '110001392E1F20,0F7129;00343589,88;0F1152702E2F71291F20,0001;0F1152702E2F71291F20,7A;00385476,521F;0F528400012E7129,0920;363F6526232227201E89,88;0F11700001397129,2E20;0F0001067C1F20,5229;0F705215261E20,012E1F;0F001A651707,565A58202E1F4763;297115030102195283840D332C2E,0F1F5863201D8A;0039077426271F1E20,0F29713852832B63;343589,88;0F03706A4F0D332C528384532E29711563,45007500;0F0370010239332E2C19528384532971156375262720,;003854637519,205D1D1F52151E21;0001020352666A,0F7020262938172F;00261F2322271E200C89,;007083624C,0F38202E7D4F45471F71;0F000102030D332C2E195283845329716375261E2322,;0F033915666A52261E272048,382E2F6329712C01;003989,88;00010203450D3329152C2E2F5375,0F638A6A1D8A38;39006A26201F,0F520D38580629712B;343589,88;528384542E03700F111869565A7566631F1E2021,297138000C;0F1118000102030D70332C2E195283845329711563261F0C20,47457525;00173883546365756619,466115201F701D475224;0F18000102111A1703154F2C2E382D2F807566,7163708A1F207D;5D0007363F232227261E21,037C0F471F20;0F00701A17830E544C5C78,7129632E1F38208A452F;2C2E5B000739337C38802D44484C2425201F1E272621,52297015;0F11185C0370332D152322528384636626271E,2F292C2E1F000106;000F7765,2E1F7C46;111879690001020370396A2E2D528384543E637566,0F380D580F2920;00013974150726271F1E200C,0F06520D297170382B45;34353989,0F20;0F528471295B795D2B155333565A446375661F201E272621,00016B0C41;0F181100010603797B7C802D302F2B6743441F202322,2952477D25;11180F71297000010604032A0D793969302F33802D636675,201F52565A1E;11180F000704030D7C684580302F153867534775,702041;00262322271F1E203F8B65,52290F0380;002C7080305C784C62,2E1F4720;000704036939487C4466,0F70112938;54528384700001020339482D301571565A363F637566,06292B201F8A;005040,522E1F0F2C20;18110001032A0D845B7129302F791533536678,0F208A1F1D;076A7626271F1E20,0D0F29382F2E;7B7C343589,0F70;11180F71297052838454792A0D33802D153853201F1E212627,012F564766;0001067011185B0D332C2E2D712909262322271F200C,0F526325;00195475667689,5229152E20;0004037B7C0F79494766754667,80293869208A;003F657789,7152290F032B;525400045B17791A565D754C7866,2E1F207C;71297C790001062A0F802D,5215705D;0470170F191A134C8384662426232227201E,;00170F7665776489,;074889,88;', + '0F0001020D700339332C192A83842971152E1F0C20262322,0652563861;1F2027260076232289,0F295283;34357C89,0111180F2920;0F030001022A0D3945297115528384637020,476A382E1F44;5B11180001020328700D332C2E195283847115632F751F2720,290F4766;0F0001021A175D2C19152E302F7183846379,8A20704F754541;0F11180300706A2E1549466319,292F26806B382B207545;00704F0D332C2E2D15363F261F20274C,0F2906036F47;0F11180001027039302971542F7526201E,63472E151F58;390001022C2E302F1575804B2D261F20,0D0F0319707D5229717A;076A79040363660F5D363F,52292E1F20382F155601;006A38075040,0F630141202B454F;0F1118000106287129705B032C2E302F802D4E2B201F,5284583841;002876396577261F20,5283290F;07343589,0652;181100012A0D52842953411E20,2E1F0F4715;0F0001062871292E7C528384032C5C2A15767765,11185D8A206B;0F181138171A7975665B52845415,47701F8A20;0F181100062839707952542C2E302F03565A7566441F1E,0D29802B20;0F280001363F8B4326232220,2E1F47032F7D;0F17000728705448757A,522E1F15562F;00076A74173926271F1E20,0F7029522B;04170F79195D1A637566363F76,01522E8A20;700718111A302F717566,0F2B2E20;11180F000128032A0D7129302C2E2F2D802B09411F1E20,52845438;0076777566262322271F201E,0F11185229;34357C89,8A20;010670170F0E3A294152838454262322271F201E,2E181544;01023918112E2D493E52756624262322271F20,;04033918110F0D2C2E7129332D2B72528384547566,;017018110F1A2E15495247838463462322271F,;0F000106387129,2E1F;0F707500261E20,382E1F;181100012C2E2F1F20,0F52;181170792C2F7129,5220;07504089,0F01;0F0001062E7129,5220;7665261F20,0F29;077C343589,88;0F18117052000171291E20,2E1F;0F181100017B7C2E71291F20,036F;181100015B3875,2E20;0F000102702E15471F1E,294F2B452C2F2680;0F000102700D332C712E15261F201E,80036A614738;0001020370392F80712B546675201E26,1F58472E15;0039076A7426271F2048,0F79197029717A38;04031975363F6366,0F5401202C5283842E2F;3807504089,88;00020370454F0D3933192C2E2D156375261F202322,0F71;003F261F202789,88;343589,88;002627651E20232289,88;0F0D33000103452E528384297115752620,63386F70;0003391983845475,2E1F0F6A702971722A0D;0F00010203703915632719792322,8026204529715875;002E4344793F26271F20,03702C2F292B381A;001A2B5448701938754C,152E202425;0039332C2E2D2F152B4644261F1E,0F7019382971637A;11180370392A0D3329712C2F156375795B5D,450C8A00382E1F2001;5040000738,0F7D7C584F012063452B;', + '000150402627,0F292F2B;0079110F0304062A528423222627207A19701A2C2E2F5D83,2945;001779332D2322271E2007760304,38290F;0007343589,71297063;0004037039180F332D152952262322271F0C533A83,41178047;0079192E2F030417332D1552847A5D,4E20;001A170F1379232227761926,712938;88,26205283;001A170F5B332E2D7129261E203E5D,15035283;007022230726,2E17712952302F;00077A7089,88;88,;07262723221F40,0F712952;0F000102070D70332C2E19528384297115637526201E2322,;03392D2E332F211D201F1E27,0F7015380029710D1958;343589,88;0F0102700D332C2E2F0319528384531529716345261F2322,;5283845300031929150D332C2E63,0F217045208A7175;006A79190F6F2627,6B4620453829;00211D1E232289,;0F7045332C2E71201F1D21,47011552295303;00704889,88;0F00040370396A742E15444948,458A384F20;5283845303702971150D2F,388A6A6D0F20;0007504089,88;0F00010203700D332C2E1929711552838453637526202322,;393589,88;007C343589,88;0F11180003706A4F0D332C2E192971155363751F20262322,5247464161;528384545363000103332E15,0F1F197029710D757D20;0F006A1938271779,565A4575522F801F1E63;001D23221E2789,52290F2E1F20;0F175B3975660745514F2B4825201E211D,010352292E;007007482089,2E1F5847;0F110039702C2E522F1574487B7C2D4E804B,098A20453861;111852838453546319297115030D332B2C,060F8A2E38201F;0007504089,0F291570;030102062C2E543E3D636679,380D1946297100;0339332C2E302B66201D1F27,0D2971010015520F6B;34357B7C89,7129;0F111800010203700D332C2E192971152F4B49471F270C2322,52562B20;0F111800010203391929710D1552838453,2075708A45630941;00177689,0F52804F25;00396577647969271E2322,52012E1F262061;1707702C2E71291F20,0F52000106111D;0070,0F292C2E791F;0F18110001702C2E7129,6F454F098A20;705283845B0D2F71,0F202E41;0007504089,060F71702F29;0F5C5B0001032A0D7052842C2E71291F20,1118517D46;07762623221F1E20,000F1552296B2F;89,6B;181100012A0D2C2E2F2B2D304E447129841F,0F0941613820;03020E0F18110D332C2E2D2F4971293E615244756653,8A2025;000F76,032E1F522C292B;0028397976771E232227,0F522E474420;7039170F45513A2C2E7129242526271F201D,0001035215;0001027007834878,2E388A201D;703911170E2C2E2D2F4B15712952633D,092B8A20;03047039171A533852443D363F,;', + '111879076A1A171523221E272024,5229700F1D012E292B0C2F;390050404C89,0F5283296920;261F1E20232289,52290058363F;0F0001020370332C2E2F1575261F,2971476A45835238;0007343589,0F292F7020;00021719792B155D5466774962,010611180F2920;0F1118528384530001035C702971152B332C2E63201F1E23222621,6B75452D4F80;00177179546A76,0F52443D1F;0001020603700F7B7C2E1F692D48302F565A586366240C21,2B151A2920;0F1A1716007015713F261F2720,5263587D2B4703;005C702C2F802B154C78,5A562E1F208A454663;00037039454F0D332971152C4C48,090F476341382E;11185283847975661271393D692D15565A201E262322,292F060D0C;004089,0F52;767789,5283002920;0F111800010206032A0D097170292D302F1575761320,521F4725;000739343589,520F;181179838454637566,0F52290120;5C0F1811790070528471291F20,2F03805125;003854767789,2E1F5220;0F18110001707B7C0D7129,52565A152B20;170007386A7448363F261F1E,030F79636F20;11180F000102587B7C5283847971302F804B2B497675,09612E1F20;705C4C39171A4F0E7971295B5248,0F2E1F1D;076A171552847983546578,712970010F;004C504089,0F521547;7665262322271F201E21,0F00298071;00010206090D5B7952838454685D7B7C443D77656366201F1E,030F47454F;343589,88;790F181113332C2E2D302F1554,70012038;00040301067018111A0F332C15292A261E200C7A7919712F5D52838454,5617454F;003826232277,632E2052;000106073018110F3329271E0C7A0D75,38262015;0F005B261F20,2E2F;384C,8A20;076A696819,0F29;036F791E20,522E1F;00654C89,;262322271F1E20,7129;0F18117000012E71291F20,527A;0039343589,;1811795B5466,0120;0F1811705200012E71291F20,062B;003F89,88;000102035270392E2D5863,0F381D2B29212015;00391A6A15384C4943363F7448,0F0379472B63;00701A17794C0F302F715475,2E454F8A2024;000102037039714515750D33,201D381F092E0F11;5283845479036A2627201E,0F380D70297115012F;4C4089,88;261F201E232289,;002627241F1E20232289,;0039343589,88;0F0211195465756679,2F384570202B6A;0F0052037029710D332C15,7545584F8A201D21;0F003854,20521D21;0F0001020370390D1952838453542971631F0C,1520;0F0001022E154826271F1E203874362322,0363;0001020370392F2971152B54754C,458A1F0F2046;000370396A450D332F4B154C,0F208A7D41381F2E;', + '00790F072C2E0103047018111A262322271E7A302F5448637545,29381556;6A79363F65,0F292B71;000118111A332C2E2D1571292A23222627200C7A791970302F5D5283845456,387C454F;000118111A332C2E2D1571292A2627200C7A1979,387C;00040318110F1519262322271E2021,52831F38;0039343589,88;00390103040618111A17332C2E262322271E157A7071302F45631F2075,807C;000118111A16175B154C26271E200C232279302F5D528384547543,0F297C7A;074889,88;88,;010670181126271F202165,2938;000770171989,0F2E2038;000106040318111A170F33292A26276A201D0C7A71077C1F1E74694F,52;88,;5283845354037029711575262720,631F58000F2E3801;0F0001020370390D3319297115632E2C752620212322,;0339332C2E1575201E26,0F520D631F29712A724738;343589,88;0F00030D70332C2E3952838453542971156375,6B20;00010203396A79637566201D211E,29387D71707A;00076527262322,1552835A201D0F38;3989,;1500443626271F1E,29710F47380D195203;000789,;0F0370390D332C192E2971637547202322,5815;031A2B7915656A,0F177001204529710D632E2F;0F03700D332C2E2971152F52838463,01004547380C;0F000102030D7033528384534529711520,634758;006A6F391974,0F2E614447702C292F71201F3852;34357B7C89,0F20;11180F00010E715229702E79692C2D2B15093954444C66,2F565A8061;000102033945332C6375201D21,0F1929710D70;07487677393F89,0F2952151F1D;0F17000102060370392E52838453331F,452F2C266A79292B2038;161A0F1526271F4C,5861034738;3950177089,522E1F0F20;11180F0001020370391952845329712B632E7B7C792D2C8020,385D15;00046A7966444C7765,010C202F38520F70292E;70545283842E71291A7933192A5D5A5040,090C384F45208A1D6B;0F11180006032A0D70332E011954838471152C202322,58477D63;0F111800037039450D2971332C632026,1F2E2B385283;003934357B7C89,0F20;00481F2023221E27262189,0F292C2E;18117900012C2E5B1F20,0F710D5229;000776776548,0F1118152E1F20;5254700001020612692D4E584647336375662E1F1E,71290D2620;006A583F232227261F20,0F29154703;00077089,522E1F8A20;0F5C707971292C2E0E032A0D6A804B2D8C2B3348634C,521109154620;04795B3F651A5D,0F52010620;117154528384292C2E302D4E092A0D50407970443D,56804100;18115452840001712970802D2C2E302F2B2A0D78791F,0F20475861;0F1811000104037115454F7677657B7C392023222726210C,52092E1F;34350089,0F20;0F111800171A454F514E3A3871157765443D23221E262720,80612E1F;111800010206037939695483845D2D2E4E446375661F262120,0F52290D71;767779392623222789,152B1F1D20;000102060717706A33392D2E4E674447482322271E210C,71292B4F20;0F171511793F76584C,0347200C1D;000789,88;' + ]; + + protected static hourTaboo: string[] = [ + '0F520120,6D61;0F7083520115000255,80262F;707A000855,0102;0100380806,707A2E2C;0F8352150255,70717A7D01002C0306;0F707A0120002C0855,88;,88;0F71832952202C,7A7D0102;0F70835201150255,2E2C;0F295220380255,707A01000306;0F83295201200255,70717A7D2C;0F707A0120002C0855,80262F;707A000855,0102;0F708352150255,2E01002C0806;0F522055,707A01000306;0F700120002C380855,;0F835201150255,70717A7D802C262F;0F70718329527A202C55,0102;,88;0F702952200255,7A7D01000306;0F7083527A01150255,;0F70012000380255,80262F;000855,70717A7D012C02;0F7071527A2055,2E2C;0F522055,707A01000306;0F7001200255,;0F7071297A0115202C55,80262F;0F71832952002C380806,707A0102;0F70835201150255,7A2E2C;0F200255,707A01000306;,88;0F700120002C0855,7A7D80262F;0F7083527A1555,0102;0100380806,2E2C;0F20190255,70717A7D01002C0306;0F707A0120002C0855,88;0F520120,707A6D80262F61;0F7083521555,0102;0F7071297A0115200255,2E2C;0F2952200255,707A01000306;0F835201150255,70717A7D2C;0F7001200255,80262F;,88;,7A2E7D2C;0F712915202C55,707A01000306;0F7029018020002C38,;0F835201150255,70717A7D802C262F;0F70718329527A202C55,0102;0F71832952012002,2E6D2C61;0F7029527A200255,01000806;0F71290115202C,707A55;01002C380806,707A80262F;0F8352150055,70717A7D012C02;0F715220,707A2E2C55;,88;0F7001200255,7A7D;0F835201150255,707A80262F;0F7183295220002C380806,707A010255;0F718329522002,707A2E2C55;0F2952200255,707A01000306', + '0F700120000255,;0F70290120000855,6D61;0F707129527A15802C381955,01000806;0F7101200019020655,707A2C;0F200855,707A2E01002C0306;0F7183520115802C0255,707A;0F700120000255,;,88;0F70297A01202C380955,;0F8352150255,707A01002C0306;0F0120000855,707A2E2C;0F7071297A01158020002C0855,;0F7083520115000255,;0F70717A01201955,6D61;0F7071295215802C3855,01000806;0F0120000206,707A2C;0F290120000855,707A2E2C;0F7083527A0115202C0255,;0100380806,2E2C;,88;0F707129527A011580202C380255,;0F7083520115000255,;0F71202C1955,707A;0F707129527A1556802C1955,;0F202C4B,707A01000306;0F71201955,707A6D61;0F70202C55,01000806;0F0120000206,707A2C;0F7101201955,707A2E2C;0F7129521556802C0255,707A01000306;01002C380806,;,88;0F7129527A0115802C380255,;0F83520115000255,707A2C;0F202C0855,707A01000306;0F7129521556802C1955,707A;0F700120002C0855,;202C,6D61;0F71295215802C3802,01000806;0F2002,707A01002C0306;0F29012002,707A2E2C;0F708329527A0115202C0255,;01002C380806,;,88;0F71295215802C380855,707A01000306;0F83520115000255,707A;0F0120000855,707A2E2C;0F707129527A1556802C1955,;0F7083520115000255,;,707A01000306;0F707129527A15802C3855,01000806;0F290120000855,707A2C;0F71201955,707A2E2C;0F7183520115802C02,707A55;0F202C0855,707A01000306;,88;0F0120002C086C,707A55;0F83520115000255,707A2C;0F2901202C3809,707A55;0F7129521556802C196C,707A0100030655', + '0F70297A0120000855,80262F;0F832952202C,0102;0F71832952012002,7A2E7D2C;0F712915202C55,707A01000306;0F718329520120002C380802066C,707A;707A01000855,80262F;0F7083527A1555,0102;0F7001200255,2E2C;,88;0F7071297A15202C55,01000806;0F7083527A0115000255,80262F;0F83521555,70717A7D012C02;0F70718329527A200255,2E01002C0806;0F52,0120002C080306;0F7183295201202C02,7A7D;0F708352150255,01800026082F06;0F7071297A20002C38080655,0102;0F0120000855,707A2E2C;0F708352150255,0120002C080306;0F832952202C02,01000806;,88;0F7071297A15202C55,0102;0F708352011500380255,2E2C;0F202C4B,01000806;0F71832952202C0255,707A;0F7083527A01150255,80262F;0F71832952202C,7A7D016D02;0F712915202C,01800026082F06;0F71292055,707A01000306;,707A01000806;0F7083527A0115000255,80262F;0F71832952202C,0102;,88;0F712915202C,707A01000306;0F835201150255,707A;0F70835201150255,80262F;0F70717A201955,0102;0F7001200255,2E2C;,707A01000306;0F7071297A15202C55,01000806;0F70297A012000380855,80262F;0F2920,70717A7D016D2C02;0F708352150255,2E01002C0806;,707A01000306;,88;0F7083527A01150255,2E2C;0F8352150038,707A010255;0F83520115000255,70717A7D2C;,707A01000306;0F5220,01000806;0F70297A0120000855,80262F;0F712915202C,016D000806;0F70718329527A01200038080206,2E2C;0F832952202C02,707A01000306;0F835201150255,707A;0F7083527A01150255,80262F;,88;0F7071297A011520002C55,;0F708352150255,01000806;0F8352150255,70717A7D01002C0806', + '0F71832952202C02,707A;0F7029527A0120000255,;0F7071527A202C55,88;0F71295215802C3802,707A01000306;55,707A01000806;0F292055,707A2E2C;0F708329527A202C0255,01000806;0F708352150255,01000806;0F202C0855,707A01000306;,88;0F8329520115200255,707A2C;0F7083527A01150255,;0F7129521556802C1955,707A;2C3808,707A01000306;70297A0120002C0855,88;29202C,6D61;0F708329527A202C0255,01000806;0F71522055,707A2E01002C0806;0F7129521556802C0855,707A01000306;0F7083520115000255,;0F71290120002C080206,88;,88;0F0120004B,707A2C;0F8352150255,707A2E01002C0306;71295201155680002C0855,707A;0F70290120002C06,;0F832952202C0255,01000806;71295215802C38,01000806;0F7071832952202C0255,01000806;0F70718329520120002C080255,;0F70718329527A202C0255,;0F7083527A01150255,;0F70717A01200008190655,88;,88;0F8329520115200255,707A2C;0F708329527A0115202C0255,;0F707129527A011556802C026C,;2C38,01000806;0F202C0855,707A01000306;0F70712952011580202C380255,;0F718329522002,707A01002C0806;0F295201200255,707A2E2C;0F707129527A011556802C026C,;0F8352150255,707A01000306;0F70297A01202C0255,88;,88;0F8352150255,707A01002C0806;0F8352150255,707A2E01002C0806;0F712952155680202C0255,707A01000306;0F7029012000080255,;0F70718329527A202C0255,88;0F707129527A0180202C0255,;,707A01000806;0F832952202C02,707A01000306;707129527A01155680002C0855,;0F70832952011520002C0255,;0F832952202C02,01000806;,88;0F8352150255,707A01002C0306;0F83520115000255,707A2E2C', + '0F83521555,70717A7D016D2C02;,2E2C;0F5220,707A01000306;0F0120000206,707A;0F835201150255,707A80262F;0F70717A202C381955,01000806;0F0120000206,70717A7D2C;0F7129202C1955,707A01000306;0F7083527A0115000255,;0F7083520115000255,80262F;,88;0F70717A0120003808190655,2E2C;0F8352150255,707A01000306;,2E2C;0F7083527A01150255,80262F;0F70200006,7A7D016D02;0F7071297A01152055,2E6D2C41;2C38,01000806;0F290120000855,70717A7D2C;0F70835201150255,80262F;0F702920002C,0102;0F0120004B,2E2C;,88;0F70717A0120002C3808190655,;0F7083520115000255,80262F;,0102;0F7071527A01200655,2E2C;0F702002,7A7D01000306;0F7129011520002C,6D41;0F70835215380255,01800026082F06;0F200006,70717A7D016D2C02;,2E2C;0F83521502,707A0100030655;0F7083520115000255,7A7D;,88;0F70717A20002C3808190655,016D02;0F835201150255,70717A7D2C;0F7129202C1955,707A01000306;0F520120006C,707A55;0F7083520115000255,7A7D80262F;0F712915202C,707A016D02;0F70717A20381955,2E01002C0806;0F29202C02,707A01000306;0F83295201202C02,707A;0F70835201150255,80262F;0F7083521555,7A7D016D02;,88;0F71202C38081955,707A01000306;0F83520115000255,70717A7D2C;0F70835201150255,80262F;0F70527A2055,016D02;0F0120000206,707A2E2C;0F712915202C,707A016D00034106;2C38,707A01000806;0F83520115000255,70717A7D802C262F;0F832952202C,0102;0F7083527A01150255,2E2C;0F708352150255,7A7D01000306;,88;01002C380806,80262F', + '0F8329520102,707A202C03;0F7183520115802C0255,707A;0F29522055,707A01000306;0F70718329527A01202C0255,88;0F707129527A15803855,202C03;0F71832952200255,707A2C03;0F71832952012002,707A2E2C;0F7129521556802C0855,707A01000306;0F700120000255,;0F70010255,202C03;0F707129520115800038,202C03;,88;0F29522055,707A2E01002C0306;0F707183527A0115802C0255,;0F70297A55,202C03;0F7071297A0255,202C03;0F718329520120002C080206,;0F29200855,707A01000306;55,707A2E01002C0806;0F7071295201155680000855,202C03;0F01004B,202C03;0F835201150255,707A;0F7129521580202C3855,707A01000306;,88;0F70297A55,202C03;0F707183520115800255,202C03;0F7183295201002C38080206,;0F29200855,707A01000306;0F70297A202C02,01000806;0F70297A01000855,202C03;0F712920,707A2E01002C080306;0F7129521556802C55,707A;0F8352150255,707A01000306;0F8352011502,707A55;0F29526C,707A202C0355;,88;0F718329522002,707A2E2C;0F71835215802C0255,707A01000306;0F70202C55,01000806;0F707A01000855,202C03;0F707129520115800038,202C03;0F290180202C380955,707A6D61;0F7029527A2055,01000806;0F707129527A1556802C0255,;0F71520106,707A202C03;0F70835201150255,202C03;0F718329520120002C080206,;,88;0F200255,707A2E01002C0806;0F70718352011580000255,202C03;0F715201066C,707A202C03;0F290180202C380955,707A;0F71295215802C3855,707A01000306;0F70717A20190255,016D00086106;0F712952,0120002C080306;0F70718329527A0255,202C03;0F7183295201002C38080206,707A;0F8352150255,707A01000306;0F70202C55,01000806;,88', + ',88;0F832952200255,70717A7D01002C0306;0F70835201150255,88;0F7083527A01150255,2E2C;0F70202C55,7A7D0102;0F7029527A012055,2E2C;0F2920380855,707A01000306;0F83520115000255,70717A7D2C;0F7083527A01150255,80262F;0F52202C,016D02;0F70835201150255,7A2E7D2C;0F71832952202C0255,707A01000306;,88;0F835201150255,70717A7D802C262F;0F712952202C,0102;0F70527A012055,2E2C;700855,7A7D01000306;0F7071297A011520002C55,;0F8352011500380255,707A80262F;0F7083521555,010002;0F71290120,707A2E2C;0F71832952202C02,707A0100030655;0F7083527A01150255,;0F7001200255,2E2C;,88;0F707A01200255,2E2C;0F83521502,707A0100030655;0F0120002C086C,707A55;0F7083527A01150255,80262F;0F712915202C,016D02;0F2901203809,707A2E2C;0F708352150255,01000806;0F7183295201202C02,88;0F7083527A01150255,80262F;0F7083527A1555,0102;0F7071297A01152055,2E2C;,88;0F707A01200255,;0F70835201150255,80262F;0F52202C,016D02;0F71522055,707A2E2C;0F712915202C02,707A01000306;0F718329520120002C3802,6D41;0F7083527A150255,01800026082F06;0F71832952202C,0102;0F70527A012055,2E2C;0855,707A01000306;707A01000855,;,88;0F522055,70717A7D012C02;0F835201150255,707A2E2C;0F71832952202C02,707A01000306;0F707183295201202C0255,7A7D;0F7083527A01150255,80262F;0F71832952002C380806,016D0241;0F70200255,2E01002C0806;0855,707A01000306;0F700120002C0855,;0F70835201150255,7A7D80262F;0F712915202C,016D02', + '0F290120002C0855,707A;,88;0F7071295201155680002C0206,;0F70832952011520002C0255,;0F70297A01202C0255,88;0F70712901158020002C380855,;0F8352150255,707A01000306;0F71201955,707A2E6D2C61;0F70297A0120002C0206,;0F710120002C3808190655,707A;0F290120002C0855,707A;0F71835215802C380255,707A01000306;,707A2E2C;,88;0F7071295201155680002C0855,;0F7083520115000255,;0F7120081955,707A01000306;0F7071295201158020002C380206,;0F0120004B,707A2C;0F71201955,707A;0F707129521556802C55,01000806;2C3808,707A0100030655;0F71201955,707A;0F70832952011520002C0255,;0F01200255,707A2C;,88;0F7129521556802C0855,707A01000306;0F70290120002C,;0F2901202C,88;0F71295201158020002C380206,707A;0F01200255,707A2C;0F71201955,707A2E016D002C036106;0F7129521556802C02,01000806;0F8329520120002C02,;0F70297A01202C0255,88;0F7083520115000255,;0F202C0855,707A01000306;,88;0F7071297A0120002C19020655,;0F83520115000255,707A;0F70297A01202C0255,88;0F71295215802C3802,707A01000306;0F835201150255,707A2C;0F71201955,707A2E2C;0F70712952155680202C0255,01000806;0F70290120000855,;0F202C0855,707A01000306;0F70718352011580002C380255,;0F7129202C1955,707A;,88;0F707129520115568020002C0255,;0F8352150255,707A01000306;0F70717A201955,2E2C;0F70290120002C0206,;0F01200255,707A2C;0F290120000855,707A2E6D2C61;0F707129521556802C55,01000806;01002C380806,;0F71201955,707A;0F718352011580002C380255,707A', + '0F708352150255,01000806;0F707A010255,202C03;,88;2920002C0806,0102;0F7083527A01150255,2E2C;0F200255,707A01000306;0F7029527A0155,202C03;0F7083527A011500380255,80262F;0F83295220,70717A7D016D2C02;0F70717A201955,2E01002C0806;0F70527A2055,01000806;707A55,0120002C080306;0F70835201150255,80262F;002C380806,707A010255;,88;0F2002,707A0100030655;0F7029527A010255,202C03;0F0120002C4B02,80262F;0F7071297A15202C55,0102;0F70717A0120003808190655,2E2C;0F8329522002,70717A7D01002C0806;707A55,0120002C080306;0F7083527A01150255,80262F;29202C,7A7D016D02;0F7083520115000255,2E2C;0F71202C38081955,707A01000306;,88;0F70835201150255,80262F;0F7083521555,0102;0F7083527A01150255,2E2C;0F7071297A15202C55,01000806;0F700255,0120002C080306;0F835201150255,70717A7D6D802C262F61;,016D0002;0F70297A0120000855,2E2C;0F70200255,7A7D01000306;0F708329527A01150255,202C03;0F7083527A011500380255,80262F;,88;0F70717A201955,2E2C;0F708352150255,01000806;0F708352150255,0120002C080306;0F7083527A01150255,80262F;0F70717A2000381955,0102;0F290120000855,70717A7D2C;0F70202C55,01000806;0F70527A0155,202C03;0F70835201150255,7A7D80262F;0F7083521555,0102;0F70717A0120003808190655,2E2C;,88;0F7055,0120002C080306;0F70835201150255,80262F;0F7083521555,7A7D016D02;0F70297A0120000855,2E2C;0F71202C38081955,707A01000306;0F29522055,70717A7D2C03;0F708352150255,01800026082F06;0F522055,707A0102;0F71201955,707A2E2C', + '71295215802C380855,707A01000306;0F835201150255,707A2C;0F832952011520000255,707A2E2C;,88;0F708352150255,01000806;0F8352150255,707A01000306;0F70718329527A202C0255,;0F292055,707A2C;0F83295201200255,707A2E2C;0F707129527A011556802C55,6D41;707A55,01000806;,707A55;0F70297A0120002C0855,;0F7083520115000255,;,707A2E01002C0806;,88;0F718329520120002C080206,;0F835201150255,707A;0F83295201202C02,707A55;,707A55;0855,707A2E01002C0306;0F707129527A1556802C55,6D41;0F7029202C55,01000806;0F700120002C0855,88;0F707129527A15802C3855,01000806;0F708352150255,01000806;0F71832952012002,707A2E2C;,88;0F7083520115000255,;0F835201150255,707A;71295215802C380855,707A01000306;,707A2C;0F0120000855,707A2E2C;0F7029012000080255,6D41;0F707152202C,01000806;0F71832952202C02,01000806;0F70718329527A01202C0255,;0F708329527A0115202C0255,;0F8329520120000255,707A2E2C;,88;0F8352150255,707A01000306;0F70835201150255,88;0F707A0120002C0855,;0F700120002C080255,;,707A2E01002C0806;0F71832952202C02,01000806;0F718329522C3802,01000806;0F2952202C55,707A;0F707129527A0115802C380255,;0F2901802000,707A2C;0855,707A2E01002C0306;,88;0F70832952011520002C0255,;0F7083520115000255,;0F707129527A15802C380255,01000806;0F718329522002,707A01002C0806;0F7183295201200002,707A2E2C;0F702901202C0255,6D41;2C38,01000806;0F7071297A2055,88', + '0F7071201955,7A7D;0F71290115202C,707A80262F;0F70835215003855,016D02;0F835201150255,70717A7D2C;,88;0F520120,707A55;0F835201150255,707A80262F;0F71291520002C,016D02;0100380806,707A2E2C55;0F71201955,707A01000306;0F71295201202C,6D61;0F5220,01800026082F06;0F7071201955,7A7D016D02;0F7129011520,707A2E2C;2C3808,707A01000306;0F0120004B,70717A7D2C;,88;0F5220,016D02;0F70835201150255,7A2E7D2C;0F712915202C,707A01000306;0F70717A0120002C3808190655,;0F7083527A01150255,80262F;0F70200006,016D0261;0F5220,2E01002C0806;0F71201955,707A01000306;0F7129011520002C,707A;0F708352011500380255,80262F;0F83521555,70717A7D016D2C02;,88;0F5220,707A01000306;0F70835201150255,7A7D;0F835201150255,707A80262F;002C380806,016D02;0F201955,70717A7D2C;0F2002,707A016D00036106;0F5220,01000806;0F835201150255,707A80262F;0F71291520002C,016D02;0F708352011500380255,2E2C;0F8352150255,70717A7D01002C0306;,88;0F7083527A01150255,80262F;0F7083527A1555,016D02;0F7129011520,707A2E2C;2C3808,707A01000306;0F71201955,707A;0F7083520115000255,80262F;0F5220,016D0002;0F7071201955,7A2E7D2C;0F712915202C,707A01000306;0F7083527A011500380255,;0F835201150255,70717A7D802C262F;,88;0F7071520120002C06,;0F29202C55,707A01000306;0F7129011520002C,707A;0F8352011500380255,707A80262F;0F71201955,707A0102;0F700120000206,6D61;0F5220,01000806', + '0F7183295201202C02,707A55;0F7029527A0120002C0255,;0F83520115000255,707A2C03;0F83520115000255,707A2E2C;0F7129521556802C1955,707A01000306;,88;0F7129202C196C,707A55;0F7183520115803802,707A202C0355;0F29522055,707A2C;0F71832952200255,707A2E01002C0306;0F718329520120002C080206,;0F290120000855,707A;0F700255,0120002C080306;707129527A011580002C380855,;0F204B,707A01002C0306;0F835201150255,707A;0F7071297A202C1955,;,88;0F707A01200255,88;0F71835215802C380255,707A01000306;0F7183295201202C02,;0F290120000855,707A2E2C;0F7071295201155680000855,202C03;01000855,707A;0F70717A201955,01000806;0F7129520115802C3855,707A;0F8329520115200255,707A2C;0F835201150255,707A2E2C03;0F707129527A1580202C55,;,88;0F70718329527A202C0255,88;0F70718352011580002C380255,;0F01200255,707A2C03;01000855,707A2E2C;0F7129521556802C1955,707A01000306;01002C380806,707A6D41;0F7071297A202C1955,01000806;0F707129527A15803855,202C03;0F01200255,707A2C;0F8352150255,707A01000306;0F71832952202C02,;,88;0F707A010255,202C03;707129527A011580002C380855,;0F29202C3809,707A01000306;0F71201955,707A;0F7071297A202C1955,;0100380806,6D202C0341;0F7029527A2055,01000806;0F71295215802C3855,707A01000306;0F835201150255,707A2C;0F832952011520000255,707A2E2C;0F7071295201155680000855,202C03;,88;0F29202C380955,707A01000306;0F7183520115802C380255,707A;29202C,707A;0F71292055,707A2E2C03;0F707129527A1556802C55,;0F71832952202C02,707A016D00034106' + ]; + + protected constructor(indexOfName: number | string) { + super(Taboo.NAMES, indexOfName); + } + + static fromIndex(index: number): Taboo { + return new Taboo(index); + } + + static fromName(name: string): Taboo { + return new Taboo(name); + } + + next(n: number): Taboo { + return Taboo.fromIndex(this.nextIndex(n)); + } + + static getDayRecommends(month: SixtyCycle, day: SixtyCycle): Taboo[] { + const l: Taboo[] = []; + const data: string = Taboo.dayTaboo[month.getEarthBranch().getIndex()].split(';', -1)[day.getIndex()].split(',', -1)[0]; + for (let i: number = 0, j: number = data.length; i < j; i += 2) { + l.push(Taboo.fromIndex(parseInt(data.substring(i, i + 2), 16))); + } + return l; + } + + static getDayAvoids(month: SixtyCycle, day: SixtyCycle): Taboo[] { + const l: Taboo[] = []; + const data: string = Taboo.dayTaboo[month.getEarthBranch().getIndex()].split(';', -1)[day.getIndex()].split(',', -1)[1]; + for (let i: number = 0, j: number = data.length; i < j; i += 2) { + l.push(Taboo.fromIndex(parseInt(data.substring(i, i + 2), 16))); + } + return l; + } + + static getHourRecommends(day: SixtyCycle, hour: SixtyCycle): Taboo[] { + const l: Taboo[] = []; + const data: string = Taboo.hourTaboo[hour.getEarthBranch().getIndex()].split(';', -1)[day.getIndex()].split(',', -1)[0]; + for (let i: number = 0, j: number = data.length; i < j; i += 2) { + l.push(Taboo.fromIndex(parseInt(data.substring(i, i + 2), 16))); + } + return l; + } + + static getHourAvoids(day: SixtyCycle, hour: SixtyCycle): Taboo[] { + const l: Taboo[] = []; + const data: string = Taboo.hourTaboo[hour.getEarthBranch().getIndex()].split(';', -1)[day.getIndex()].split(',', -1)[1]; + for (let i: number = 0, j: number = data.length; i < j; i += 2) { + l.push(Taboo.fromIndex(parseInt(data.substring(i, i + 2), 16))); + } + return l; + } +} + export class Ten extends LoopTyme { static NAMES: string[] = ['甲子', '甲戌', '甲申', '甲午', '甲辰', '甲寅']; @@ -667,17 +808,17 @@ export class HeavenStem extends LoopTyme { } getTenStar(target: HeavenStem): TenStar { - const hostElement: Element = this.getElement(); - const guestElement: Element = target.getElement(); + const host: Element = this.getElement(); + const guest: Element = target.getElement(); let index: number = 0; const sameYinYang: boolean = this.getYinYang() == target.getYinYang(); - if (hostElement.getReinforce().equals(guestElement)) { + if (host.getReinforce().equals(guest)) { index = 1; - } else if (hostElement.getRestrain().equals(guestElement)) { + } else if (host.getRestrain().equals(guest)) { index = 2; - } else if (guestElement.getRestrain().equals(hostElement)) { + } else if (host.getRestrained().equals(guest)) { index = 3; - } else if (guestElement.getReinforce().equals(hostElement)) { + } else if (host.getReinforced().equals(guest)) { index = 4; } return TenStar.fromIndex(index * 2 + (sameYinYang ? 0 : 1)); @@ -1319,7 +1460,7 @@ export class LunarYear extends AbstractTyme { getMonths(): LunarMonth[] { const l: LunarMonth[] = []; let m: LunarMonth = LunarMonth.fromYm(this.year, 1); - while (m.getYear().getYear() === this.year) { + while (m.getYear() === this.year) { l.push(m); m = m.next(1); } @@ -1431,10 +1572,14 @@ export class LunarMonth extends AbstractTyme { return new LunarMonth(year, month); } - getYear(): LunarYear { + getLunarYear(): LunarYear { return this.year; } + getYear(): number { + return this.year.getYear(); + } + getMonth(): number { return this.month; } @@ -1477,7 +1622,7 @@ export class LunarMonth extends AbstractTyme { next(n: number): LunarMonth { if (n === 0) { - return LunarMonth.fromYm(this.year.getYear(), this.getMonthWithLeap()); + return LunarMonth.fromYm(this.getYear(), this.getMonthWithLeap()); } let m: number = this.indexInYear + 1 + n; let y: LunarYear = this.year; @@ -1509,7 +1654,7 @@ export class LunarMonth extends AbstractTyme { } getDays(): LunarDay[] { - const y: number = this.year.getYear(); + const y: number = this.getYear(); const m: number = this.getMonthWithLeap(); const l: LunarDay[] = []; for (let i: number = 0, j: number = this.getDayCount(); i < j; i++) { @@ -1519,7 +1664,7 @@ export class LunarMonth extends AbstractTyme { } getWeeks(start: number): LunarWeek[] { - const y: number = this.year.getYear(); + const y: number = this.getYear(); const m: number = this.getMonthWithLeap(); const l: LunarWeek[] = []; for (let i: number = 0, j: number = this.getWeekCount(start); i < j; i++) { @@ -1547,7 +1692,7 @@ export class LunarMonth extends AbstractTyme { } equals(o: LunarMonth): boolean { - return this.year.equals(o.getYear()) && this.getMonthWithLeap() === o.getMonthWithLeap(); + return this.getYear() === o.getYear() && this.getMonthWithLeap() === o.getMonthWithLeap(); } } @@ -1578,10 +1723,18 @@ export class LunarWeek extends AbstractTyme { return new LunarWeek(year, month, index, start); } - getMonth(): LunarMonth { + getLunarMonth(): LunarMonth { return this.month; } + getYear(): number { + return this.month.getYear(); + } + + getMonth(): number { + return this.month.getMonthWithLeap(); + } + getIndex(): number { return this.index; } @@ -1601,7 +1754,7 @@ export class LunarWeek extends AbstractTyme { next(n: number): LunarWeek { const startIndex: number = this.start.getIndex(); if (n === 0) { - return LunarWeek.fromYm(this.month.getYear().getYear(), this.month.getMonthWithLeap(), this.index, startIndex); + return LunarWeek.fromYm(this.getYear(), this.getMonth(), this.index, startIndex); } let d: number = this.index + n; let m: LunarMonth = this.month; @@ -1612,13 +1765,13 @@ export class LunarWeek extends AbstractTyme { if (forward) { d -= weeksInMonth; } else { - if (!LunarDay.fromYmd(m.getYear().getYear(), m.getMonthWithLeap(), 1).getWeek().equals(this.start)) { + if (!LunarDay.fromYmd(m.getYear(), m.getMonthWithLeap(), 1).getWeek().equals(this.start)) { d += add; } } m = m.next(add); if (forward) { - if (!LunarDay.fromYmd(m.getYear().getYear(), m.getMonthWithLeap(), 1).getWeek().equals(this.start)) { + if (!LunarDay.fromYmd(m.getYear(), m.getMonthWithLeap(), 1).getWeek().equals(this.start)) { d += add; } } @@ -1627,11 +1780,11 @@ export class LunarWeek extends AbstractTyme { d += weeksInMonth; } } - return LunarWeek.fromYm(m.getYear().getYear(), m.getMonthWithLeap(), d, startIndex); + return LunarWeek.fromYm(m.getYear(), m.getMonthWithLeap(), d, startIndex); } getFirstDay(): LunarDay { - const firstDay: LunarDay = LunarDay.fromYmd(this.month.getYear().getYear(), this.month.getMonthWithLeap(), 1); + const firstDay: LunarDay = LunarDay.fromYmd(this.getYear(), this.getMonth(), 1); return firstDay.next(this.index * 7 - this.indexOf(firstDay.getWeek().getIndex() - this.start.getIndex(), 7)); } @@ -1665,10 +1818,18 @@ export class LunarDay extends AbstractTyme { return new LunarDay(year, month, day); } - getMonth(): LunarMonth { + getLunarMonth(): LunarMonth { return this.month; } + getYear(): number { + return this.month.getYear(); + } + + getMonth(): number { + return this.month.getMonthWithLeap(); + } + getDay(): number { return this.day; } @@ -1683,7 +1844,7 @@ export class LunarDay extends AbstractTyme { next(n: number): LunarDay { if (n === 0) { - return LunarDay.fromYmd(this.month.getYear().getYear(), this.month.getMonthWithLeap(), this.day); + return LunarDay.fromYmd(this.getYear(), this.getMonth(), this.day); } let d: number = this.day + n; let m: LunarMonth = this.month; @@ -1700,37 +1861,33 @@ export class LunarDay extends AbstractTyme { d += daysInMonth; } } - return LunarDay.fromYmd(m.getYear().getYear(), m.getMonthWithLeap(), d); + return LunarDay.fromYmd(m.getYear(), m.getMonthWithLeap(), d); } isBefore(target: LunarDay): boolean { - const bMonth: LunarMonth = target.getMonth(); - const aYear: number = this.month.getYear().getYear(); - const bYear: number = bMonth.getYear().getYear(); + const aYear: number = this.getYear(); + const bYear: number = target.getYear(); if (aYear !== bYear) { return aYear < bYear; } - if (this.month.getMonth() !== bMonth.getMonth()) { - return this.month.getMonth() < bMonth.getMonth(); - } - if (this.month.isLeap() && !bMonth.isLeap()) { - return false; + const aMonth: number = this.getMonth(); + const bMonth: number = target.getMonth(); + if (aMonth !== bMonth) { + return Math.abs(aMonth) < Math.abs(bMonth); } return this.day < target.getDay(); } isAfter(target: LunarDay): boolean { - const bMonth: LunarMonth = target.getMonth(); - const aYear: number = this.month.getYear().getYear(); - const bYear: number = bMonth.getYear().getYear(); + const aYear: number = this.getYear(); + const bYear: number = target.getYear(); if (aYear !== bYear) { return aYear > bYear; } - if (this.month.getMonth() !== bMonth.getMonth()) { - return this.month.getMonth() > bMonth.getMonth(); - } - if (this.month.isLeap() && !bMonth.isLeap()) { - return true; + const aMonth: number = this.getMonth(); + const bMonth: number = target.getMonth(); + if (aMonth != bMonth) { + return Math.abs(aMonth) >= Math.abs(bMonth); } return this.day > target.getDay(); } @@ -1741,9 +1898,9 @@ export class LunarDay extends AbstractTyme { getYearSixtyCycle(): SixtyCycle { const solarDay: SolarDay = this.getSolarDay(); - const solarYear: number = solarDay.getMonth().getYear().getYear(); + const solarYear: number = solarDay.getYear(); const springSolarDay: SolarDay = SolarTerm.fromIndex(solarYear, 3).getJulianDay().getSolarDay(); - const lunarYear: LunarYear = this.month.getYear(); + const lunarYear: LunarYear = this.month.getLunarYear(); const year: number = lunarYear.getYear(); let sixtyCycle: SixtyCycle = lunarYear.getSixtyCycle(); if (year === solarYear) { @@ -1760,7 +1917,7 @@ export class LunarDay extends AbstractTyme { getMonthSixtyCycle(): SixtyCycle { const solarDay: SolarDay = this.getSolarDay(); - const year: number = solarDay.getMonth().getYear().getYear(); + const year: number = solarDay.getYear(); const term: SolarTerm = solarDay.getTerm(); let index: number = term.getIndex() - 3; if (index < 0 && term.getJulianDay().getSolarDay().isAfter(SolarTerm.fromIndex(year, 3).getJulianDay().getSolarDay())) { @@ -1784,7 +1941,7 @@ export class LunarDay extends AbstractTyme { getNineStar(): NineStar { const solar: SolarDay = this.getSolarDay(); - const dongZhi: SolarTerm = SolarTerm.fromIndex(solar.getMonth().getYear().getYear(), 0); + const dongZhi: SolarTerm = SolarTerm.fromIndex(solar.getYear(), 0); const xiaZhi: SolarTerm = dongZhi.next(12); const dongZhi2: SolarTerm = dongZhi.next(24); const dongZhiSolar: SolarDay = dongZhi.getJulianDay().getSolarDay(); @@ -1814,7 +1971,7 @@ export class LunarDay extends AbstractTyme { if (index % 12 < 6) { return Direction.fromIndex([2, 8, 4, 6, 0][~~(index / 12)]); } - return this.month.getYear().getJupiterDirection(); + return this.month.getLunarYear().getJupiterDirection(); } getFetusDay(): FetusDay { @@ -1834,26 +1991,38 @@ export class LunarDay extends AbstractTyme { } getFestival(): LunarFestival | null { - return LunarFestival.fromYmd(this.month.getYear().getYear(), this.month.getMonthWithLeap(), this.day); + return LunarFestival.fromYmd(this.getYear(), this.getMonth(), this.day); } getSixStar(): SixStar { return SixStar.fromIndex((this.month.getMonth() + this.day - 2) % 6); } + getGods(): God[] { + return God.getDayGods(this.getMonthSixtyCycle(), this.getSixtyCycle()); + } + + getRecommends(): Taboo[] { + return Taboo.getDayRecommends(this.getMonthSixtyCycle(), this.getSixtyCycle()); + } + + getAvoids(): Taboo[] { + return Taboo.getDayAvoids(this.getMonthSixtyCycle(), this.getSixtyCycle()); + } + getHours(): LunarHour[] { const l: LunarHour[] = []; - const y: number = this.month.getYear().getYear(); - const m: number = this.month.getMonth(); + const y: number = this.getYear(); + const m: number = this.getMonth(); l.push(LunarHour.fromYmdHms(y, m, this.day, 0, 0, 0)); - for (let i = 0; i < 24; i += 2) { + for (let i: number = 0; i < 24; i += 2) { l.push(LunarHour.fromYmdHms(y, m, this.day, i + 1, 0, 0)); } return l; } equals(o: LunarDay): boolean { - return this.month.equals(o.getMonth()) && this.day === o.getDay(); + return this.getMonth() === o.getMonth() && this.day === o.getDay(); } } @@ -1884,10 +2053,22 @@ export class LunarHour extends AbstractTyme { return new LunarHour(year, month, day, hour, minute, second); } - getDay(): LunarDay { + getLunarDay(): LunarDay { return this.day; } + getYear(): number { + return this.day.getYear(); + } + + getMonth(): number { + return this.day.getMonth(); + } + + getDay(): number { + return this.day.getDay(); + } + getHour(): number { return this.hour; } @@ -1923,13 +2104,12 @@ export class LunarHour extends AbstractTyme { days--; } const d: LunarDay = this.day.next(days); - const month: LunarMonth = d.getMonth(); - return LunarHour.fromYmdHms(month.getYear().getYear(), month.getMonthWithLeap(), d.getDay(), hour, this.minute, this.second); + return LunarHour.fromYmdHms(d.getYear(), d.getMonth(), d.getDay(), hour, this.minute, this.second); } isBefore(target: LunarHour): boolean { - if (!this.day.equals(target.getDay())) { - return this.day.isBefore(target.getDay()); + if (!this.day.equals(target.getLunarDay())) { + return this.day.isBefore(target.getLunarDay()); } if (this.hour !== target.getHour()) { return this.hour < target.getHour(); @@ -1938,8 +2118,8 @@ export class LunarHour extends AbstractTyme { } isAfter(target: LunarHour): boolean { - if (!this.day.equals(target.getDay())) { - return this.day.isAfter(target.getDay()); + if (!this.day.equals(target.getLunarDay())) { + return this.day.isAfter(target.getLunarDay()); } if (this.hour !== target.getHour()) { return this.hour > target.getHour(); @@ -1949,9 +2129,9 @@ export class LunarHour extends AbstractTyme { getYearSixtyCycle(): SixtyCycle { const solarTime: SolarTime = this.getSolarTime(); - const solarYear: number = this.day.getSolarDay().getMonth().getYear().getYear(); + const solarYear: number = this.day.getSolarDay().getYear(); const springSolarTime: SolarTime = SolarTerm.fromIndex(solarYear, 3).getJulianDay().getSolarTime(); - const lunarYear: LunarYear = this.day.getMonth().getYear(); + const lunarYear: LunarYear = this.day.getLunarMonth().getLunarYear(); const year: number = lunarYear.getYear(); let sixtyCycle: SixtyCycle = lunarYear.getSixtyCycle(); if (year === solarYear) { @@ -1968,7 +2148,7 @@ export class LunarHour extends AbstractTyme { getMonthSixtyCycle(): SixtyCycle { const solarTime: SolarTime = this.getSolarTime(); - const year: number = solarTime.getDay().getMonth().getYear().getYear(); + const year: number = solarTime.getYear(); const term: SolarTerm = solarTime.getTerm(); let index: number = term.getIndex() - 3; if (index < 0 && term.getJulianDay().getSolarTime().isAfter(SolarTerm.fromIndex(year, 3).getJulianDay().getSolarTime())) { @@ -1990,7 +2170,7 @@ export class LunarHour extends AbstractTyme { getNineStar(): NineStar { const solar: SolarDay = this.day.getSolarDay(); - const dongZhi: SolarTerm = SolarTerm.fromIndex(solar.getMonth().getYear().getYear(), 0); + const dongZhi: SolarTerm = SolarTerm.fromIndex(solar.getYear(), 0); const xiaZhi: SolarTerm = dongZhi.next(12); const asc: boolean = !solar.isBefore(dongZhi.getJulianDay().getSolarDay()) && solar.isBefore(xiaZhi.getJulianDay().getSolarDay()); let start: number = [8, 5, 2][this.day.getSixtyCycle().getEarthBranch().getIndex() % 3]; @@ -2003,16 +2183,23 @@ export class LunarHour extends AbstractTyme { getSolarTime(): SolarTime { const d: SolarDay = this.day.getSolarDay(); - const m: SolarMonth = d.getMonth(); - return SolarTime.fromYmdHms(m.getYear().getYear(), m.getMonth(), d.getDay(), this.hour, this.minute, this.second); + return SolarTime.fromYmdHms(d.getYear(), d.getMonth(), d.getDay(), this.hour, this.minute, this.second); } getEightChar(): EightChar { return new EightChar(this.getYearSixtyCycle(), this.getMonthSixtyCycle(), this.getDaySixtyCycle(), this.getSixtyCycle()); } + getRecommends(): Taboo[] { + return Taboo.getHourRecommends(this.getDaySixtyCycle(), this.getSixtyCycle()); + } + + getAvoids(): Taboo[] { + return Taboo.getHourAvoids(this.getDaySixtyCycle(), this.getSixtyCycle()); + } + equals(o: LunarHour): boolean { - return this.day.equals(o.getDay()) && this.hour === o.getHour() && this.minute === o.getMinute() && this.second === o.getSecond(); + return this.day.equals(o.getLunarDay()) && this.hour === o.getHour() && this.minute === o.getMinute() && this.second === o.getSecond(); } } @@ -2927,10 +3114,14 @@ export class SolarHalfYear extends AbstractTyme { return new SolarHalfYear(year, index); } - getYear(): SolarYear { + getSolarYear(): SolarYear { return this.year; } + getYear(): number { + return this.year.getYear(); + } + getIndex(): number { return this.index; } @@ -2994,10 +3185,14 @@ export class SolarSeason extends AbstractTyme { return new SolarSeason(year, index); } - getYear(): SolarYear { + getSolarYear(): SolarYear { return this.year; } + getYear(): number { + return this.year.getYear(); + } + getIndex(): number { return this.index; } @@ -3053,16 +3248,20 @@ export class SolarMonth extends AbstractTyme { return new SolarMonth(year, month); } - getYear(): SolarYear { + getSolarYear(): SolarYear { return this.year; } + getYear(): number { + return this.year.getYear(); + } + getMonth(): number { return this.month; } getDayCount(): number { - if (1582 === this.year.getYear() && 10 === this.month) { + if (1582 === this.getYear() && 10 === this.month) { return 21; } let d: number = SolarMonth.DAYS[this.getIndexInYear()]; @@ -3078,11 +3277,11 @@ export class SolarMonth extends AbstractTyme { } getSeason(): SolarSeason { - return SolarSeason.fromIndex(this.year.getYear(), ~~(this.getIndexInYear() / 3)); + return SolarSeason.fromIndex(this.getYear(), ~~(this.getIndexInYear() / 3)); } getWeekCount(start: number): number { - return Math.ceil((this.indexOf(SolarDay.fromYmd(this.year.getYear(), this.month, 1).getWeek().getIndex() - start, 7) + this.getDayCount()) / 7); + return Math.ceil((this.indexOf(SolarDay.fromYmd(this.getYear(), this.month, 1).getWeek().getIndex() - start, 7) + this.getDayCount()) / 7); } getName(): string { @@ -3095,10 +3294,10 @@ export class SolarMonth extends AbstractTyme { next(n: number): SolarMonth { if (n == 0) { - return SolarMonth.fromYm(this.year.getYear(), this.month); + return SolarMonth.fromYm(this.getYear(), this.month); } let m: number = this.month + n; - let y: number = this.year.getYear() + ~~(m / 12); + let y: number = this.getYear() + ~~(m / 12); m %= 12; if (m < 1) { m += 12; @@ -3109,8 +3308,8 @@ export class SolarMonth extends AbstractTyme { getWeeks(start: number): SolarWeek[] { const l: SolarWeek[] = []; - const y: number = this.year.getYear(); - for (let i: number = 0; i < this.getWeekCount(start); i++) { + const y: number = this.getYear(); + for (let i: number = 0, j: number = this.getWeekCount(start); i < j; i++) { l.push(SolarWeek.fromYm(y, this.month, i, start)); } return l; @@ -3118,8 +3317,8 @@ export class SolarMonth extends AbstractTyme { getDays(): SolarDay[] { const l: SolarDay[] = []; - const y: number = this.year.getYear(); - for (let i: number = 0; i < this.getDayCount(); i++) { + const y: number = this.getYear(); + for (let i: number = 0, j: number = this.getDayCount(); i < j; i++) { l.push(SolarDay.fromYmd(y, this.month, i + 1)); } return l; @@ -3153,10 +3352,18 @@ export class SolarWeek extends AbstractTyme { return new SolarWeek(year, month, index, start); } - getMonth(): SolarMonth { + getSolarMonth(): SolarMonth { return this.month; } + getYear(): number { + return this.month.getYear(); + } + + getMonth(): number { + return this.month.getMonth(); + } + getIndex(): number { return this.index; } @@ -3164,7 +3371,7 @@ export class SolarWeek extends AbstractTyme { getIndexInYear(): number { let i: number = 0; // 今年第1周 - let w: SolarWeek = SolarWeek.fromYm(this.month.getYear().getYear(), 1, 0, this.start.getIndex()); + let w: SolarWeek = SolarWeek.fromYm(this.getYear(), 1, 0, this.start.getIndex()); while (!w.equals(this)) { w = w.next(1); i++; @@ -3187,7 +3394,7 @@ export class SolarWeek extends AbstractTyme { next(n: number): SolarWeek { const startIndex: number = this.start.getIndex(); if (n === 0) { - return SolarWeek.fromYm(this.month.getYear().getYear(), this.month.getMonth(), this.index, startIndex); + return SolarWeek.fromYm(this.getYear(), this.getMonth(), this.index, startIndex); } let d: number = this.index + n; let m: SolarMonth = this.month; @@ -3198,13 +3405,13 @@ export class SolarWeek extends AbstractTyme { if (forward) { d -= weeksInMonth; } else { - if (!SolarDay.fromYmd(m.getYear().getYear(), m.getMonth(), 1).getWeek().equals(this.start)) { + if (!SolarDay.fromYmd(m.getYear(), m.getMonth(), 1).getWeek().equals(this.start)) { d += add; } } m = m.next(add); if (forward) { - if (!SolarDay.fromYmd(m.getYear().getYear(), m.getMonth(), 1).getWeek().equals(this.start)) { + if (!SolarDay.fromYmd(m.getYear(), m.getMonth(), 1).getWeek().equals(this.start)) { d += add; } } @@ -3213,11 +3420,11 @@ export class SolarWeek extends AbstractTyme { d += weeksInMonth; } } - return SolarWeek.fromYm(m.getYear().getYear(), m.getMonth(), d, startIndex); + return SolarWeek.fromYm(m.getYear(), m.getMonth(), d, startIndex); } getFirstDay(): SolarDay { - const firstDay: SolarDay = SolarDay.fromYmd(this.month.getYear().getYear(), this.month.getMonth(), 1); + const firstDay: SolarDay = SolarDay.fromYmd(this.getYear(), this.getMonth(), 1); return firstDay.next(this.index * 7 - this.indexOf(firstDay.getWeek().getIndex() - this.start.getIndex(), 7)); } @@ -3258,10 +3465,18 @@ export class SolarDay extends AbstractTyme { return new SolarDay(year, month, day); } - getMonth(): SolarMonth { + getSolarMonth(): SolarMonth { return this.month; } + getYear(): number { + return this.month.getYear(); + } + + getMonth(): number { + return this.month.getMonth(); + } + getDay(): number { return this.day; } @@ -3272,7 +3487,7 @@ export class SolarDay extends AbstractTyme { getConstellation(): Constellation { let index: number = 11; - const y: number = this.month.getMonth() * 100 + this.day; + const y: number = this.getMonth() * 100 + this.day; if (y >= 321 && y <= 419) { index = 0; } else if (y >= 420 && y <= 520) { @@ -3312,23 +3527,25 @@ export class SolarDay extends AbstractTyme { } isBefore(target: SolarDay): boolean { - const bMonth: SolarMonth = target.getMonth(); - const aYear: number = this.month.getYear().getYear(); - const bYear: number = bMonth.getYear().getYear(); + const aYear: number = this.getYear(); + const bYear: number = target.getYear(); if (aYear !== bYear) { return aYear < bYear; } - return this.month.getMonth() !== bMonth.getMonth() ? this.month.getMonth() < bMonth.getMonth() : this.day < target.getDay(); + const aMonth: number = this.getMonth(); + const bMonth: number = target.getMonth(); + return aMonth !== bMonth ? aMonth < bMonth : this.day < target.getDay(); } isAfter(target: SolarDay): boolean { - const bMonth: SolarMonth = target.getMonth(); - const aYear: number = this.month.getYear().getYear(); - const bYear: number = bMonth.getYear().getYear(); + const aYear: number = this.getYear(); + const bYear: number = target.getYear(); if (aYear !== bYear) { return aYear > bYear; } - return this.month.getMonth() !== bMonth.getMonth() ? this.month.getMonth() > bMonth.getMonth() : this.day > target.getDay(); + const aMonth: number = this.getMonth(); + const bMonth: number = target.getMonth(); + return aMonth !== bMonth ? aMonth > bMonth : this.day > target.getDay(); } getTerm(): SolarTerm { @@ -3336,8 +3553,8 @@ export class SolarDay extends AbstractTyme { } getTermDay(): SolarTermDay { - let y: number = this.month.getYear().getYear(); - let i: number = this.month.getMonth() * 2; + let y: number = this.getYear(); + let i: number = this.getMonth() * 2; if (i == 24) { y += 1; i = 0; @@ -3352,8 +3569,8 @@ export class SolarDay extends AbstractTyme { } getSolarWeek(start: number): SolarWeek { - const y: number = this.month.getYear().getYear(); - const m: number = this.month.getMonth(); + const y: number = this.getYear(); + const m: number = this.getMonth(); return SolarWeek.fromYm(y, m, Math.ceil((this.day + SolarDay.fromYmd(y, m, 1).getWeek().next(-start).getIndex()) / 7.0) - 1, start); } @@ -3369,7 +3586,7 @@ export class SolarDay extends AbstractTyme { } getDogDay(): DogDay | null { - const xiaZhi: SolarTerm = SolarTerm.fromIndex(this.month.getYear().getYear(), 12); + const xiaZhi: SolarTerm = SolarTerm.fromIndex(this.getYear(), 12); // 第1个庚日 let start: SolarDay = xiaZhi.getJulianDay().getSolarDay(); let add: number = 6 - start.getLunarDay().getSixtyCycle().getHeavenStem().getIndex(); @@ -3412,7 +3629,7 @@ export class SolarDay extends AbstractTyme { getPlumRainDay(): PlumRainDay | null { // 芒种 - const grainInEar: SolarTerm = SolarTerm.fromIndex(this.month.getYear().getYear(), 11); + const grainInEar: SolarTerm = SolarTerm.fromIndex(this.getYear(), 11); let start: SolarDay = grainInEar.getJulianDay().getSolarDay(); let add: number = 2 - start.getLunarDay().getSixtyCycle().getHeavenStem().getIndex(); if (add < 0) { @@ -3438,7 +3655,7 @@ export class SolarDay extends AbstractTyme { } getNineDay(): NineDay | null { - const year: number = this.month.getYear().getYear(); + const year: number = this.getYear(); let start: SolarDay = SolarTerm.fromIndex(year + 1, 0).getJulianDay().getSolarDay(); if (this.isBefore(start)) { start = SolarTerm.fromIndex(year, 0).getJulianDay().getSolarDay(); @@ -3452,7 +3669,7 @@ export class SolarDay extends AbstractTyme { } getIndexInYear(): number { - return this.subtract(SolarDay.fromYmd(this.month.getYear().getYear(), 1, 1)); + return this.subtract(SolarDay.fromYmd(this.getYear(), 1, 1)); } subtract(target: SolarDay): number { @@ -3460,25 +3677,25 @@ export class SolarDay extends AbstractTyme { } getJulianDay(): JulianDay { - return JulianDay.fromYmdHms(this.month.getYear().getYear(), this.month.getMonth(), this.day, 0, 0, 0); + return JulianDay.fromYmdHms(this.getYear(), this.getMonth(), this.day, 0, 0, 0); } getLunarDay(): LunarDay { - let m: LunarMonth = LunarMonth.fromYm(this.month.getYear().getYear(), this.month.getMonth()); + let m: LunarMonth = LunarMonth.fromYm(this.getYear(), this.getMonth()); let days: number = this.subtract(m.getFirstJulianDay().getSolarDay()); while (days < 0) { m = m.next(-1); days = this.subtract(m.getFirstJulianDay().getSolarDay()); } - return LunarDay.fromYmd(m.getYear().getYear(), m.getMonthWithLeap(), days + 1); + return LunarDay.fromYmd(m.getYear(), m.getMonthWithLeap(), days + 1); } getLegalHoliday(): LegalHoliday | null { - return LegalHoliday.fromYmd(this.month.getYear().getYear(), this.month.getMonth(), this.day); + return LegalHoliday.fromYmd(this.getYear(), this.getMonth(), this.day); } getFestival(): SolarFestival | null { - return SolarFestival.fromYmd(this.month.getYear().getYear(), this.month.getMonth(), this.day); + return SolarFestival.fromYmd(this.getYear(), this.getMonth(), this.day); } } @@ -3509,10 +3726,22 @@ export class SolarTime extends AbstractTyme { return new SolarTime(year, month, day, hour, minute, second); } - getDay(): SolarDay { + getSolarDay(): SolarDay { return this.day; } + getYear(): number { + return this.day.getYear(); + } + + getMonth(): number { + return this.day.getMonth(); + } + + getDay(): number { + return this.day.getDay(); + } + getHour(): number { return this.hour; } @@ -3538,8 +3767,7 @@ export class SolarTime extends AbstractTyme { next(n: number): SolarTime { if (n == 0) { - const m: SolarMonth = this.day.getMonth(); - return SolarTime.fromYmdHms(m.getYear().getYear(), m.getMonth(), this.day.getDay(), this.hour, this.minute, this.second); + return SolarTime.fromYmdHms(this.getYear(), this.getMonth(), this.getDay(), this.hour, this.minute, this.second); } let ts: number = this.second + n; let tm: number = this.minute + ~~(ts / 60); @@ -3562,13 +3790,12 @@ export class SolarTime extends AbstractTyme { } const d: SolarDay = this.day.next(td); - const m: SolarMonth = d.getMonth(); - return SolarTime.fromYmdHms(m.getYear().getYear(), m.getMonth(), d.getDay(), th, tm, ts); + return SolarTime.fromYmdHms(d.getYear(), d.getMonth(), d.getDay(), th, tm, ts); } isBefore(target: SolarTime): boolean { - if (!this.day.equals(target.getDay())) { - return this.day.isBefore(target.getDay()); + if (!this.day.equals(target.getSolarDay())) { + return this.day.isBefore(target.getSolarDay()); } if (this.hour !== target.getHour()) { return this.hour < target.getHour(); @@ -3577,8 +3804,8 @@ export class SolarTime extends AbstractTyme { } isAfter(target: SolarTime): boolean { - if (!this.day.equals(target.getDay())) { - return this.day.isAfter(target.getDay()); + if (!this.day.equals(target.getSolarDay())) { + return this.day.isAfter(target.getSolarDay()); } if (this.hour !== target.getHour()) { return this.hour > target.getHour(); @@ -3587,9 +3814,8 @@ export class SolarTime extends AbstractTyme { } getTerm(): SolarTerm { - const m: SolarMonth = this.day.getMonth(); - let y: number = m.getYear().getYear(); - let i: number = m.getMonth() * 2; + let y: number = this.getYear(); + let i: number = this.getMonth() * 2; if (i == 24) { y += 1; i = 0; @@ -3602,12 +3828,11 @@ export class SolarTime extends AbstractTyme { } getJulianDay(): JulianDay { - const m: SolarMonth = this.day.getMonth(); - return JulianDay.fromYmdHms(m.getYear().getYear(), m.getMonth(), this.day.getDay(), this.hour, this.minute, this.second); + return JulianDay.fromYmdHms(this.day.getYear(), this.day.getMonth(), this.day.getDay(), this.hour, this.minute, this.second); } subtract(target: SolarTime): number { - let days: number = this.day.subtract(target.getDay()); + let days: number = this.day.subtract(target.getSolarDay()); const cs: number = this.hour * 3600 + this.minute * 60 + this.second; const ts: number = target.getHour() * 3600 + target.getMinute() * 60 + target.getSecond(); let seconds: number = cs - ts; @@ -3621,8 +3846,7 @@ export class SolarTime extends AbstractTyme { getLunarHour(): LunarHour { const d: LunarDay = this.day.getLunarDay(); - const m: LunarMonth = d.getMonth(); - return LunarHour.fromYmdHms(m.getYear().getYear(), m.getMonthWithLeap(), d.getDay(), this.hour, this.minute, this.second); + return LunarHour.fromYmdHms(d.getYear(), d.getMonth(), d.getDay(), this.hour, this.minute, this.second); } } @@ -3669,9 +3893,8 @@ export class LegalHoliday extends AbstractTyme { } next(n: number): LegalHoliday | null { - const m: SolarMonth = this.day.getMonth(); - const year: number = m.getYear().getYear(); - const month: number = m.getMonth(); + const year: number = this.day.getYear(); + const month: number = this.day.getMonth(); const day: number = this.day.getDay(); if (n === 0) { return LegalHoliday.fromYmd(year, month, day); @@ -3805,10 +4028,8 @@ export class SolarFestival extends AbstractTyme { } next(n: number): SolarFestival | null { - const m: SolarMonth = this.day.getMonth(); - const year: number = m.getYear().getYear(); if (n === 0) { - return SolarFestival.fromYmd(year, m.getMonth(), this.day.getDay()); + return SolarFestival.fromYmd(this.day.getYear(), this.day.getMonth(), this.day.getDay()); } const size: number = SolarFestival.NAMES.length; let t: number = this.index + n; @@ -3816,7 +4037,7 @@ export class SolarFestival extends AbstractTyme { if (t < 0) { t -= size; } - return SolarFestival.fromIndex(year + ~~(t / size), offset); + return SolarFestival.fromIndex(this.day.getYear() + ~~(t / size), offset); } } @@ -3874,8 +4095,7 @@ export class LunarFestival extends AbstractTyme { const data: string = matcher[0]; const solarTerm: SolarTerm = SolarTerm.fromIndex(year, parseInt(data.substring(4), 10)); const lunarDay: LunarDay = solarTerm.getJulianDay().getSolarDay().getLunarDay(); - const lunarMonth: LunarMonth = lunarDay.getMonth(); - if (lunarMonth.getYear().getYear() === year && lunarMonth.getMonth() === month && lunarDay.getDay() === day) { + if (lunarDay.getYear() === year && lunarDay.getMonth() === month && lunarDay.getDay() === day) { return new LunarFestival(FestivalType.TERM, lunarDay, solarTerm, data); } matcher = reg.exec(LegalHoliday.DATA); @@ -3884,7 +4104,7 @@ export class LunarFestival extends AbstractTyme { if (matcher) { const lunarDay: LunarDay = LunarDay.fromYmd(year, month, day); const nextDay: LunarDay = lunarDay.next(1); - if (nextDay.getMonth().getMonth() === 1 && nextDay.getDay() === 1) { + if (nextDay.getMonth() === 1 && nextDay.getDay() === 1) { return new LunarFestival(FestivalType.EVE, lunarDay, null, matcher[0]); } } @@ -3916,10 +4136,8 @@ export class LunarFestival extends AbstractTyme { } next(n: number): LunarFestival { - const m: LunarMonth = this.day.getMonth(); - const year: number = m.getYear().getYear(); if (n === 0) { - return LunarFestival.fromYmd(year, m.getMonthWithLeap(), this.day.getDay()); + return LunarFestival.fromYmd(this.day.getYear(), this.day.getMonth(), this.day.getDay()); } const size: number = LunarFestival.NAMES.length; let t: number = this.index + n; @@ -3927,7 +4145,7 @@ export class LunarFestival extends AbstractTyme { if (t < 0) { t -= size; } - return LunarFestival.fromIndex(year + ~~(t / size), offset); + return LunarFestival.fromIndex(this.day.getYear() + ~~(t / size), offset); } } @@ -4015,11 +4233,11 @@ export class EightChar extends AbstractCulture { term = term.next(m); } let solarTime: SolarTime = term.getJulianDay().getSolarTime(); - if (solarTime.getDay().getMonth().getYear().getYear() >= startYear) { + if (solarTime.getYear() >= startYear) { let mi: number = 0; let s: number = 0; // 日干支和节令干支的偏移值 - let solarDay: SolarDay = solarTime.getDay(); + let solarDay: SolarDay = solarTime.getSolarDay(); const d: number = this.day.next(-solarDay.getLunarDay().getSixtyCycle().getIndex()).getIndex(); if (d > 0) { // 从节令推移天数 @@ -4029,8 +4247,7 @@ export class EightChar extends AbstractCulture { mi = solarTime.getMinute(); s = solarTime.getSecond(); } - const solarMonth: SolarMonth = solarDay.getMonth(); - const time: SolarTime = SolarTime.fromYmdHms(solarMonth.getYear().getYear(), solarMonth.getMonth(), solarDay.getDay(), h, mi, s); + const time: SolarTime = SolarTime.fromYmdHms(solarDay.getYear(), solarDay.getMonth(), solarDay.getDay(), h, mi, s); // 验证一下 if (time.getLunarHour().getEightChar().equals(this)) { l.push(time); @@ -4113,10 +4330,7 @@ export class DefaultChildLimitProvider implements ChildLimitProvider { // 1秒 = 2分,1秒/2=0.5秒 = 1分 const minute: number = seconds * 2; - const birthday: SolarDay = birthTime.getDay(); - const birthMonth: SolarMonth = birthday.getMonth(); - - let d: number = birthday.getDay() + day; + let d: number = birthTime.getDay() + day; let h: number = birthTime.getHour() + hour; let mi: number = birthTime.getMinute() + minute; h += ~~(mi / 60); @@ -4124,14 +4338,14 @@ export class DefaultChildLimitProvider implements ChildLimitProvider { d += ~~(h / 24); h %= 24; - let sm: SolarMonth = SolarMonth.fromYm(birthMonth.getYear().getYear() + year, birthMonth.getMonth()).next(month); + let sm: SolarMonth = SolarMonth.fromYm(birthTime.getYear() + year, birthTime.getMonth()).next(month); const dc: number = sm.getDayCount(); if (d > dc) { d -= dc; sm = sm.next(1); } - return new ChildLimitInfo(birthTime, SolarTime.fromYmdHms(sm.getYear().getYear(), sm.getMonth(), d, h, mi, birthTime.getSecond()), year, month, day, hour, minute); + return new ChildLimitInfo(birthTime, SolarTime.fromYmdHms(sm.getYear(), sm.getMonth(), d, h, mi, birthTime.getSecond()), year, month, day, hour, minute); } } @@ -4145,18 +4359,16 @@ export class China95ChildLimitProvider implements ChildLimitProvider { minutes %= 360; const day: number = ~~(minutes / 12); - const birthday: SolarDay = birthTime.getDay(); - const birthMonth: SolarMonth = birthday.getMonth(); - let sm: SolarMonth = SolarMonth.fromYm(birthMonth.getYear().getYear() + year, birthMonth.getMonth()).next(month); + let sm: SolarMonth = SolarMonth.fromYm(birthTime.getYear() + year, birthTime.getMonth()).next(month); - let d: number = birthday.getDay() + day; + let d: number = birthTime.getDay() + day; const dc: number = sm.getDayCount(); if (d > dc) { d -= dc; sm = sm.next(1); } - return new ChildLimitInfo(birthTime, SolarTime.fromYmdHms(sm.getYear().getYear(), sm.getMonth(), d, birthTime.getHour(), birthTime.getMinute(), birthTime.getSecond()), year, month, day, 0, 0); + return new ChildLimitInfo(birthTime, SolarTime.fromYmdHms(sm.getYear(), sm.getMonth(), d, birthTime.getHour(), birthTime.getMinute(), birthTime.getSecond()), year, month, day, 0, 0); } } @@ -4260,7 +4472,7 @@ export class DecadeFortune extends AbstractTyme { } getStartLunarYear(): LunarYear { - return this.childLimit.getEndTime().getLunarHour().getDay().getMonth().getYear().next(this.index * 10); + return this.childLimit.getEndTime().getLunarHour().getLunarDay().getLunarMonth().getLunarYear().next(this.index * 10); } getEndLunarYear(): LunarYear { @@ -4303,7 +4515,7 @@ export class Fortune extends AbstractTyme { } getLunarYear(): LunarYear { - return this.childLimit.getEndTime().getLunarHour().getDay().getMonth().getYear().next(this.index); + return this.childLimit.getEndTime().getLunarHour().getLunarDay().getLunarMonth().getLunarYear().next(this.index); } getSixtyCycle(): SixtyCycle { diff --git a/package.json b/package.json index 3dee98b..c5d9aa8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tyme4ts", - "version": "1.0.7", + "version": "1.1.0", "description": "Tyme是一个非常强大的日历工具库,可以看作 Lunar 的升级版,拥有更优的设计和扩展性,支持公历和农历、星座、干支、生肖、节气、法定假日等。", "main": "./dist/lib/index.cjs", "module": "./dist/lib/index.mjs", diff --git a/test/EightCharTest.ts b/test/EightCharTest.ts index f0695f2..548b743 100644 --- a/test/EightCharTest.ts +++ b/test/EightCharTest.ts @@ -272,9 +272,9 @@ class EightCharTest { // 童限结束(即开始起运)的公历时刻 equal(childLimit.getEndTime().toString(), '1989年5月4日 18:24:00'); // 童限开始(即出生)的农历年干支 - equal(childLimit.getStartTime().getLunarHour().getDay().getMonth().getYear().getSixtyCycle().getName(), '癸亥'); + equal(childLimit.getStartTime().getLunarHour().getLunarDay().getLunarMonth().getLunarYear().getSixtyCycle().getName(), '癸亥'); // 童限结束(即开始起运)的农历年干支 - equal(childLimit.getEndTime().getLunarHour().getDay().getMonth().getYear().getSixtyCycle().getName(), '己巳'); + equal(childLimit.getEndTime().getLunarHour().getLunarDay().getLunarMonth().getLunarYear().getSixtyCycle().getName(), '己巳'); // 第1轮大运 const decadeFortune = childLimit.getStartDecadeFortune(); @@ -323,9 +323,9 @@ class EightCharTest { // 童限结束(即开始起运)的公历时刻 equal(childLimit.getEndTime().toString(), '2001年2月11日 18:58:00'); // 童限开始(即出生)的农历年干支 - equal(childLimit.getStartTime().getLunarHour().getDay().getMonth().getYear().getSixtyCycle().getName(), '辛未'); + equal(childLimit.getStartTime().getLunarHour().getLunarDay().getLunarMonth().getLunarYear().getSixtyCycle().getName(), '辛未'); // 童限结束(即开始起运)的农历年干支 - equal(childLimit.getEndTime().getLunarHour().getDay().getMonth().getYear().getSixtyCycle().getName(), '辛巳'); + equal(childLimit.getEndTime().getLunarHour().getLunarDay().getLunarMonth().getLunarYear().getSixtyCycle().getName(), '辛巳'); // 第1轮大运 const decadeFortune = childLimit.getStartDecadeFortune(); diff --git a/test/GodTest.ts b/test/GodTest.ts new file mode 100644 index 0000000..2d64c24 --- /dev/null +++ b/test/GodTest.ts @@ -0,0 +1,94 @@ +import {suite, test} from '@testdeck/mocha'; +import {God, LunarDay, SolarDay} from '../lib'; +import {deepEqual} from 'assert'; + +@suite +class GodTest { + @test + test0() { + const lunar: LunarDay = SolarDay.fromYmd(2004, 2, 16).getLunarDay(); + const gods: God[] = lunar.getGods(); + const ji: string[] = []; + gods.forEach(god => { + if ('吉' == god.getLuck().getName()) { + ji.push(god.getName()); + } + }); + + const xiong: string[] = []; + gods.forEach(god => { + if ('凶' == god.getLuck().getName()) { + xiong.push(god.getName()); + } + }); + + deepEqual(ji, ['天恩', '续世', '明堂']); + deepEqual(xiong, ['月煞', '月虚', '血支', '天贼', '五虚', '土符', '归忌', '血忌']); + } + + @test + test1() { + const lunar: LunarDay = SolarDay.fromYmd(2029, 11, 16).getLunarDay(); + const gods: God[] = lunar.getGods(); + const ji: string[] = []; + gods.forEach(god => { + if ('吉' == god.getLuck().getName()) { + ji.push(god.getName()); + } + }); + + const xiong: string[] = []; + gods.forEach(god => { + if ('凶' == god.getLuck().getName()) { + xiong.push(god.getName()); + } + }); + + deepEqual(ji, ['天德合', '月空', '天恩', '益后', '金匮']); + deepEqual(xiong, ['月煞', '月虚', '血支', '五虚']); + } + + @test + test2() { + const lunar: LunarDay = SolarDay.fromYmd(1954, 7, 16).getLunarDay(); + const gods: God[] = lunar.getGods(); + const ji: string[] = []; + gods.forEach(god => { + if ('吉' == god.getLuck().getName()) { + ji.push(god.getName()); + } + }); + + const xiong: string[] = []; + gods.forEach(god => { + if ('凶' == god.getLuck().getName()) { + xiong.push(god.getName()); + } + }); + + deepEqual(ji, ['民日', '天巫', '福德', '天仓', '不将', '续世', '除神', '鸣吠']); + deepEqual(xiong, ['劫煞', '天贼', '五虚', '五离']); + } + + @test + test3() { + const lunar: LunarDay = SolarDay.fromYmd(2024, 12, 27).getLunarDay(); + const gods: God[] = lunar.getGods(); + const ji: string[] = []; + gods.forEach(god => { + if ('吉' == god.getLuck().getName()) { + ji.push(god.getName()); + } + }); + + const xiong: string[] = []; + gods.forEach(god => { + if ('凶' == god.getLuck().getName()) { + xiong.push(god.getName()); + } + }); + + deepEqual(ji, ['天恩', '四相', '阴德', '守日', '吉期', '六合', '普护', '宝光']); + deepEqual(xiong, ['三丧', '鬼哭']); + } +} diff --git a/test/LunarDayTest.ts b/test/LunarDayTest.ts index acac53a..48b2f77 100644 --- a/test/LunarDayTest.ts +++ b/test/LunarDayTest.ts @@ -111,12 +111,12 @@ class LunarDayTest { @test test22() { - equal(LunarDay.fromYmd(2024, 1, 1).getMonth().getYear().getSixtyCycle().getName(), '甲辰'); + equal(LunarDay.fromYmd(2024, 1, 1).getLunarMonth().getLunarYear().getSixtyCycle().getName(), '甲辰'); } @test test23() { - equal(LunarDay.fromYmd(2023, 12, 30).getMonth().getYear().getSixtyCycle().getName(), '癸卯'); + equal(LunarDay.fromYmd(2023, 12, 30).getLunarMonth().getLunarYear().getSixtyCycle().getName(), '癸卯'); } /** @@ -152,8 +152,8 @@ class LunarDayTest { @test test26() { - const lunar = LunarDay.fromYmd(2005, 11, 23); - equal(lunar.getMonth().getSixtyCycle().getName(), '戊子'); + const lunar: LunarDay = LunarDay.fromYmd(2005, 11, 23); + equal(lunar.getLunarMonth().getSixtyCycle().getName(), '戊子'); equal(lunar.getMonthSixtyCycle().getName(), '戊子'); } } diff --git a/test/LunarMonthTest.ts b/test/LunarMonthTest.ts index d80059c..8d43ff0 100644 --- a/test/LunarMonthTest.ts +++ b/test/LunarMonthTest.ts @@ -154,44 +154,44 @@ class LunarMonthTest { @test test29() { - const d = SolarDay.fromYmd(2023, 10, 7).getLunarDay(); - equal(d.getMonth().getSixtyCycle().toString(), '壬戌'); + const d: LunarDay = SolarDay.fromYmd(2023, 10, 7).getLunarDay(); + equal(d.getLunarMonth().getSixtyCycle().toString(), '壬戌'); equal(d.getMonthSixtyCycle().toString(), '辛酉'); } @test test30() { - const d = SolarDay.fromYmd(2023, 10, 8).getLunarDay(); - equal(d.getMonth().getSixtyCycle().toString(), '壬戌'); + const d: LunarDay = SolarDay.fromYmd(2023, 10, 8).getLunarDay(); + equal(d.getLunarMonth().getSixtyCycle().toString(), '壬戌'); equal(d.getMonthSixtyCycle().toString(), '壬戌'); } @test test31() { - const d = SolarDay.fromYmd(2023, 10, 15).getLunarDay(); - equal(d.getMonth().getName(), '九月'); - equal(d.getMonth().getSixtyCycle().toString(), '癸亥'); + const d: LunarDay = SolarDay.fromYmd(2023, 10, 15).getLunarDay(); + equal(d.getLunarMonth().getName(), '九月'); + equal(d.getLunarMonth().getSixtyCycle().toString(), '癸亥'); equal(d.getMonthSixtyCycle().toString(), '壬戌'); } @test test32() { - const d = SolarDay.fromYmd(2023, 11, 7).getLunarDay(); - equal(d.getMonth().getSixtyCycle().toString(), '癸亥'); + const d: LunarDay = SolarDay.fromYmd(2023, 11, 7).getLunarDay(); + equal(d.getLunarMonth().getSixtyCycle().toString(), '癸亥'); equal(d.getMonthSixtyCycle().toString(), '壬戌'); } @test test33() { - const d = SolarDay.fromYmd(2023, 11, 8).getLunarDay(); - equal(d.getMonth().getSixtyCycle().toString(), '癸亥'); + const d: LunarDay = SolarDay.fromYmd(2023, 11, 8).getLunarDay(); + equal(d.getLunarMonth().getSixtyCycle().toString(), '癸亥'); equal(d.getMonthSixtyCycle().toString(), '癸亥'); } @test test34() { // 2023年闰2月 - const m = LunarMonth.fromYm(2023, 12); + const m: LunarMonth = LunarMonth.fromYm(2023, 12); equal(m.toString(), '农历癸卯年十二月'); equal(m.next(-1).toString(), '农历癸卯年十一月'); equal(m.next(-2).toString(), '农历癸卯年十月'); @@ -200,7 +200,7 @@ class LunarMonthTest { @test test35() { // 2023年闰2月 - const m = LunarMonth.fromYm(2023, 3); + const m: LunarMonth = LunarMonth.fromYm(2023, 3); equal(m.toString(), '农历癸卯年三月'); equal(m.next(-1).toString(), '农历癸卯年闰二月'); equal(m.next(-2).toString(), '农历癸卯年二月'); @@ -211,28 +211,28 @@ class LunarMonthTest { @test test36() { - const d = SolarDay.fromYmd(1983, 2, 15).getLunarDay(); - equal(d.getMonth().getSixtyCycle().toString(), '甲寅'); + const d: LunarDay = SolarDay.fromYmd(1983, 2, 15).getLunarDay(); + equal(d.getLunarMonth().getSixtyCycle().toString(), '甲寅'); equal(d.getMonthSixtyCycle().toString(), '甲寅'); } @test test37() { - const d = SolarDay.fromYmd(2023, 10, 30).getLunarDay(); - equal(d.getMonth().getSixtyCycle().toString(), '癸亥'); + const d: LunarDay = SolarDay.fromYmd(2023, 10, 30).getLunarDay(); + equal(d.getLunarMonth().getSixtyCycle().toString(), '癸亥'); equal(d.getMonthSixtyCycle().toString(), '壬戌'); } @test test38() { - const d = SolarDay.fromYmd(2023, 10, 19).getLunarDay(); - equal(d.getMonth().getSixtyCycle().toString(), '癸亥'); + const d: LunarDay = SolarDay.fromYmd(2023, 10, 19).getLunarDay(); + equal(d.getLunarMonth().getSixtyCycle().toString(), '癸亥'); equal(d.getMonthSixtyCycle().toString(), '壬戌'); } @test test39() { - const m = LunarMonth.fromYm(2023, 11); + const m: LunarMonth = LunarMonth.fromYm(2023, 11); equal(m.toString(), '农历癸卯年十一月'); equal(m.getSixtyCycle().toString(), '乙丑'); } diff --git a/test/SolarDayTest.ts b/test/SolarDayTest.ts index b711030..b56cf43 100644 --- a/test/SolarDayTest.ts +++ b/test/SolarDayTest.ts @@ -77,11 +77,11 @@ class SolarDayTest { @test test22() { - equal('甲辰', SolarDay.fromYmd(2024, 2, 10).getLunarDay().getMonth().getYear().getSixtyCycle().getName()); + equal('甲辰', SolarDay.fromYmd(2024, 2, 10).getLunarDay().getLunarMonth().getLunarYear().getSixtyCycle().getName()); } @test test23() { - equal('癸卯', SolarDay.fromYmd(2024, 2, 9).getLunarDay().getMonth().getYear().getSixtyCycle().getName()); + equal('癸卯', SolarDay.fromYmd(2024, 2, 9).getLunarDay().getLunarMonth().getLunarYear().getSixtyCycle().getName()); } } diff --git a/test/TabooTest.ts b/test/TabooTest.ts new file mode 100644 index 0000000..032b5e7 --- /dev/null +++ b/test/TabooTest.ts @@ -0,0 +1,77 @@ +import {suite, test} from '@testdeck/mocha'; +import {SolarDay, SolarTime} from '../lib'; +import {deepEqual} from 'assert'; + +@suite +class TabooTest { + @test + test0() { + const taboos: string[] = []; + SolarDay.fromYmd(2024, 6, 26).getLunarDay().getRecommends().forEach(t => { + taboos.push(t.getName()); + }); + + deepEqual(taboos, ['嫁娶', '祭祀', '理发', '作灶', '修饰垣墙', '平治道涂', '整手足甲', '沐浴', '冠笄']); + } + + @test + test1() { + const taboos: string[] = []; + SolarDay.fromYmd(2024, 6, 26).getLunarDay().getAvoids().forEach(t => { + taboos.push(t.getName()); + }); + + deepEqual(taboos, ['破土', '出行', '栽种']); + } + + @test + test2() { + const taboos: string[] = []; + SolarTime.fromYmdHms(2024, 6, 25, 4, 0, 0).getLunarHour().getRecommends().forEach(t => { + taboos.push(t.getName()); + }); + + deepEqual(taboos, []); + } + + @test + test3() { + const taboos: string[] = []; + SolarTime.fromYmdHms(2024, 6, 25, 4, 0, 0).getLunarHour().getAvoids().forEach(t => { + taboos.push(t.getName()); + }); + + deepEqual(taboos, ['诸事不宜']); + } + + @test + test4() { + const taboos: string[] = []; + SolarTime.fromYmdHms(2024, 4, 22, 0, 0, 0).getLunarHour().getRecommends().forEach(t => { + taboos.push(t.getName()); + }); + + deepEqual(taboos, ['嫁娶', '交易', '开市', '安床', '祭祀', '求财']); + } + + @test + test5() { + const taboos: string[] = []; + SolarTime.fromYmdHms(2024, 4, 22, 0, 0, 0).getLunarHour().getAvoids().forEach(t => { + taboos.push(t.getName()); + }); + + deepEqual(taboos, ['出行', '移徙', '赴任', '词讼', '祈福', '修造', '求嗣']); + } + + @test + test6() { + const taboos: string[] = []; + SolarDay.fromYmd(2021, 3, 7).getLunarDay().getRecommends().forEach(t => { + taboos.push(t.getName()); + }); + + deepEqual(taboos, ['裁衣', '经络', '伐木', '开柱眼', '拆卸', '修造', '动土', '上梁', '合脊', '合寿木', '入殓', '除服', '成服', '移柩', '破土', '安葬', '启钻', '修坟', '立碑']); + } + +}