PowerShell: What is My Chinese Zodiac Sign?

恭喜發財 。身體健康
Kung Hei Fat Choi*
Happy, Healthy & Prosperous Lunar Chinese New Year
(of the Rabbit)

農曆新兔年 大年初一 (2023-01-22)

########## PowerShell: What is My Chinese Zodiac Sign
#Copyright (c) All Rights Reserved 農曆新兔年 Lunar Chinese New Year of Rabbit 
#www.leedesmond.com 
#2023-01-22 Version: 1.0

param(
$MyBirthYear=(Get-Date).Year,[switch]$IncludeOutput
) 
$author ="www.leedesmond.com"; 
$scriptName="What_is_my_Chinese_Zodiac_Sign.ps1"; 
$date="2023-01-22"; 
$version="1.0";

function GetChineseZodiac()
{
param([int]$ref=1924,[int]$gap=12,$BirthYear)

[hashtable]$ChineseZodiac=[ordered]@{}; 
# 
$ChineseZodiac[1924]=[PSCustomObject]@{Year=-1;SignZmt="鼠";SignJyutPing="syu2"  ;Sign="Rat"    } #, 1936, 1948, 1960, 1972, 1984, 1996, 2008, 2020 
$ChineseZodiac[1925]=[PSCustomObject]@{Year=-1;SignZmt="牛";SignJyutPing="ngau4" ;Sign="Ox"     } #, 1937, 1949, 1961, 1973, 1985, 1997, 2009, 2021 
$ChineseZodiac[1926]=[PSCustomObject]@{Year=-1;SignZmt="虎";SignJyutPing="fu2"   ;Sign="Tiger"  } #, 1938, 1950, 1962, 1974, 1986, 1998, 2010, 2022 
$ChineseZodiac[1927]=[PSCustomObject]@{Year=-1;SignZmt="兎";SignJyutPing="tou3"  ;Sign="Rabbit" } #, 1939, 1951, 1963, 1975, 1987, 1999, 2011, 2023 
$ChineseZodiac[1928]=[PSCustomObject]@{Year=-1;SignZmt="龍";SignJyutPing="lung4" ;Sign="Dragon" } #, 1940, 1952, 1964, 1976, 1988, 2000, 2012, 2024 
$ChineseZodiac[1929]=[PSCustomObject]@{Year=-1;SignZmt="蛇";SignJyutPing="se4"   ;Sign="Snake"  } #, 1941, 1953, 1965, 1977, 1989, 2001, 2013, 2025 
$ChineseZodiac[1930]=[PSCustomObject]@{Year=-1;SignZmt="馬";SignJyutPing="maa5"  ;Sign="Horse"  } #, 1942, 1954, 1966, 1978, 1990, 2002, 2014, 2026 
$ChineseZodiac[1931]=[PSCustomObject]@{Year=-1;SignZmt="羊";SignJyutPing="joeng4";Sign="Goat"   } #, 1943, 1955, 1967, 1979, 1991, 2003, 2015, 2027 
$ChineseZodiac[1932]=[PSCustomObject]@{Year=-1;SignZmt="猴";SignJyutPing="hau4"  ;Sign="Monkey" } #, 1944, 1956, 1968, 1980, 1992, 2004, 2016, 2028 
$ChineseZodiac[1933]=[PSCustomObject]@{Year=-1;SignZmt="雞";SignJyutPing="gai1"  ;Sign="Rooster"} #, 1945, 1957, 1969, 1981, 1993, 2005, 2017, 2029 
$ChineseZodiac[1934]=[PSCustomObject]@{Year=-1;SignZmt="狗";SignJyutPing="gau2"  ;Sign="Dog"    } #, 1946, 1958, 1970, 1982, 1994, 2006, 2018, 2030 
$ChineseZodiac[1935]=[PSCustomObject]@{Year=-1;SignZmt="豬";SignJyutPing="zyu1"  ;Sign="Pig"    } #, 1947, 1959, 1971, 1983, 1995, 2007, 2019, 2031 

#calculate Chinese Zodiac year 
$result =$ref..($ref+11) | ? { $($BirthYear-$PSItem)%$gap -eq 0 } 
$result1=$ChineseZodiac[$result]; 
$result1.Year=$BirthYear; 

Write-Output $result1; 
} 

Write-Verbose "Script : $scriptName" -Verbose; 
Write-Verbose "Author : $author" -Verbose; 
Write-Verbose "Version: $date v$version" -Verbose; 

$result=GetChineseZodiac -BirthYear $MyBirthYear; 

Write-Verbose $($result|Out-String) -Verbose; 
if($IncludeOutput){Write-Output $result;} 

Write-Verbose "SignZmt=Traditional Chinese" -Verbose; 
Write-Verbose "SignJyutPing=粵拼 (jyut6 ping3) Cantonese romanization system (https://jyutping.org/)" -Verbose; 
Write-Verbose "" -Verbose;

#powershell #農曆新年 #兔年 #粵語

* gung1 hei2 faat3 coi4
(#粵拼 #JyutPing #Cantonese romanization systems)