solar_terms_24 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +26 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +81 -0
- data/LICENSE.txt +21 -0
- data/README.md +158 -0
- data/Rakefile +12 -0
- data/Timezones.md +599 -0
- data/exe/solar_terms_24 +6 -0
- data/lib/solar_terms_24/cache.rb +34 -0
- data/lib/solar_terms_24/cli.rb +18 -0
- data/lib/solar_terms_24/db/1900.json +26 -0
- data/lib/solar_terms_24/db/1901.json +26 -0
- data/lib/solar_terms_24/db/1902.json +26 -0
- data/lib/solar_terms_24/db/1903.json +26 -0
- data/lib/solar_terms_24/db/1904.json +26 -0
- data/lib/solar_terms_24/db/1905.json +26 -0
- data/lib/solar_terms_24/db/1906.json +26 -0
- data/lib/solar_terms_24/db/1907.json +26 -0
- data/lib/solar_terms_24/db/1908.json +26 -0
- data/lib/solar_terms_24/db/1909.json +26 -0
- data/lib/solar_terms_24/db/1910.json +26 -0
- data/lib/solar_terms_24/db/1911.json +26 -0
- data/lib/solar_terms_24/db/1912.json +26 -0
- data/lib/solar_terms_24/db/1913.json +26 -0
- data/lib/solar_terms_24/db/1914.json +26 -0
- data/lib/solar_terms_24/db/1915.json +26 -0
- data/lib/solar_terms_24/db/1916.json +26 -0
- data/lib/solar_terms_24/db/1917.json +26 -0
- data/lib/solar_terms_24/db/1918.json +26 -0
- data/lib/solar_terms_24/db/1919.json +26 -0
- data/lib/solar_terms_24/db/1920.json +26 -0
- data/lib/solar_terms_24/db/1921.json +26 -0
- data/lib/solar_terms_24/db/1922.json +26 -0
- data/lib/solar_terms_24/db/1923.json +26 -0
- data/lib/solar_terms_24/db/1924.json +26 -0
- data/lib/solar_terms_24/db/1925.json +26 -0
- data/lib/solar_terms_24/db/1926.json +26 -0
- data/lib/solar_terms_24/db/1927.json +26 -0
- data/lib/solar_terms_24/db/1928.json +26 -0
- data/lib/solar_terms_24/db/1929.json +26 -0
- data/lib/solar_terms_24/db/1930.json +26 -0
- data/lib/solar_terms_24/db/1931.json +26 -0
- data/lib/solar_terms_24/db/1932.json +26 -0
- data/lib/solar_terms_24/db/1933.json +26 -0
- data/lib/solar_terms_24/db/1934.json +26 -0
- data/lib/solar_terms_24/db/1935.json +26 -0
- data/lib/solar_terms_24/db/1936.json +26 -0
- data/lib/solar_terms_24/db/1937.json +26 -0
- data/lib/solar_terms_24/db/1938.json +26 -0
- data/lib/solar_terms_24/db/1939.json +26 -0
- data/lib/solar_terms_24/db/1940.json +26 -0
- data/lib/solar_terms_24/db/1941.json +26 -0
- data/lib/solar_terms_24/db/1942.json +26 -0
- data/lib/solar_terms_24/db/1943.json +26 -0
- data/lib/solar_terms_24/db/1944.json +26 -0
- data/lib/solar_terms_24/db/1945.json +26 -0
- data/lib/solar_terms_24/db/1946.json +26 -0
- data/lib/solar_terms_24/db/1947.json +26 -0
- data/lib/solar_terms_24/db/1948.json +26 -0
- data/lib/solar_terms_24/db/1949.json +26 -0
- data/lib/solar_terms_24/db/1950.json +26 -0
- data/lib/solar_terms_24/db/1951.json +26 -0
- data/lib/solar_terms_24/db/1952.json +26 -0
- data/lib/solar_terms_24/db/1953.json +26 -0
- data/lib/solar_terms_24/db/1954.json +26 -0
- data/lib/solar_terms_24/db/1955.json +26 -0
- data/lib/solar_terms_24/db/1956.json +26 -0
- data/lib/solar_terms_24/db/1957.json +26 -0
- data/lib/solar_terms_24/db/1958.json +26 -0
- data/lib/solar_terms_24/db/1959.json +26 -0
- data/lib/solar_terms_24/db/1960.json +26 -0
- data/lib/solar_terms_24/db/1961.json +26 -0
- data/lib/solar_terms_24/db/1962.json +26 -0
- data/lib/solar_terms_24/db/1963.json +26 -0
- data/lib/solar_terms_24/db/1964.json +26 -0
- data/lib/solar_terms_24/db/1965.json +26 -0
- data/lib/solar_terms_24/db/1966.json +26 -0
- data/lib/solar_terms_24/db/1967.json +26 -0
- data/lib/solar_terms_24/db/1968.json +26 -0
- data/lib/solar_terms_24/db/1969.json +26 -0
- data/lib/solar_terms_24/db/1970.json +26 -0
- data/lib/solar_terms_24/db/1971.json +26 -0
- data/lib/solar_terms_24/db/1972.json +26 -0
- data/lib/solar_terms_24/db/1973.json +26 -0
- data/lib/solar_terms_24/db/1974.json +26 -0
- data/lib/solar_terms_24/db/1975.json +26 -0
- data/lib/solar_terms_24/db/1976.json +26 -0
- data/lib/solar_terms_24/db/1977.json +26 -0
- data/lib/solar_terms_24/db/1978.json +26 -0
- data/lib/solar_terms_24/db/1979.json +26 -0
- data/lib/solar_terms_24/db/1980.json +26 -0
- data/lib/solar_terms_24/db/1981.json +26 -0
- data/lib/solar_terms_24/db/1982.json +26 -0
- data/lib/solar_terms_24/db/1983.json +26 -0
- data/lib/solar_terms_24/db/1984.json +26 -0
- data/lib/solar_terms_24/db/1985.json +26 -0
- data/lib/solar_terms_24/db/1986.json +26 -0
- data/lib/solar_terms_24/db/1987.json +26 -0
- data/lib/solar_terms_24/db/1988.json +26 -0
- data/lib/solar_terms_24/db/1989.json +26 -0
- data/lib/solar_terms_24/db/1990.json +26 -0
- data/lib/solar_terms_24/db/1991.json +26 -0
- data/lib/solar_terms_24/db/1992.json +26 -0
- data/lib/solar_terms_24/db/1993.json +26 -0
- data/lib/solar_terms_24/db/1994.json +26 -0
- data/lib/solar_terms_24/db/1995.json +26 -0
- data/lib/solar_terms_24/db/1996.json +26 -0
- data/lib/solar_terms_24/db/1997.json +26 -0
- data/lib/solar_terms_24/db/1998.json +26 -0
- data/lib/solar_terms_24/db/1999.json +26 -0
- data/lib/solar_terms_24/db/2000.json +26 -0
- data/lib/solar_terms_24/db/2001.json +26 -0
- data/lib/solar_terms_24/db/2002.json +26 -0
- data/lib/solar_terms_24/db/2003.json +26 -0
- data/lib/solar_terms_24/db/2004.json +26 -0
- data/lib/solar_terms_24/db/2005.json +26 -0
- data/lib/solar_terms_24/db/2006.json +26 -0
- data/lib/solar_terms_24/db/2007.json +26 -0
- data/lib/solar_terms_24/db/2008.json +26 -0
- data/lib/solar_terms_24/db/2009.json +26 -0
- data/lib/solar_terms_24/db/2010.json +26 -0
- data/lib/solar_terms_24/db/2011.json +26 -0
- data/lib/solar_terms_24/db/2012.json +26 -0
- data/lib/solar_terms_24/db/2013.json +26 -0
- data/lib/solar_terms_24/db/2014.json +26 -0
- data/lib/solar_terms_24/db/2015.json +26 -0
- data/lib/solar_terms_24/db/2016.json +26 -0
- data/lib/solar_terms_24/db/2017.json +26 -0
- data/lib/solar_terms_24/db/2018.json +26 -0
- data/lib/solar_terms_24/db/2019.json +26 -0
- data/lib/solar_terms_24/db/2020.json +26 -0
- data/lib/solar_terms_24/db/2021.json +26 -0
- data/lib/solar_terms_24/db/2022.json +26 -0
- data/lib/solar_terms_24/db/2023.json +26 -0
- data/lib/solar_terms_24/db/2024.json +26 -0
- data/lib/solar_terms_24/db/2025.json +26 -0
- data/lib/solar_terms_24/db/2026.json +26 -0
- data/lib/solar_terms_24/db/2027.json +26 -0
- data/lib/solar_terms_24/db/2028.json +26 -0
- data/lib/solar_terms_24/db/2029.json +26 -0
- data/lib/solar_terms_24/db/2030.json +26 -0
- data/lib/solar_terms_24/db/2031.json +26 -0
- data/lib/solar_terms_24/db/2032.json +26 -0
- data/lib/solar_terms_24/db/2033.json +26 -0
- data/lib/solar_terms_24/db/2034.json +26 -0
- data/lib/solar_terms_24/db/2035.json +26 -0
- data/lib/solar_terms_24/db/2036.json +26 -0
- data/lib/solar_terms_24/db/2037.json +26 -0
- data/lib/solar_terms_24/db/2038.json +26 -0
- data/lib/solar_terms_24/db/2039.json +26 -0
- data/lib/solar_terms_24/db/2040.json +26 -0
- data/lib/solar_terms_24/db/2041.json +26 -0
- data/lib/solar_terms_24/db/2042.json +26 -0
- data/lib/solar_terms_24/db/2043.json +26 -0
- data/lib/solar_terms_24/db/2044.json +26 -0
- data/lib/solar_terms_24/db/2045.json +26 -0
- data/lib/solar_terms_24/db/2046.json +26 -0
- data/lib/solar_terms_24/db/2047.json +26 -0
- data/lib/solar_terms_24/db/2048.json +26 -0
- data/lib/solar_terms_24/db/2049.json +26 -0
- data/lib/solar_terms_24/db/2050.json +26 -0
- data/lib/solar_terms_24/db/2051.json +26 -0
- data/lib/solar_terms_24/db/2052.json +26 -0
- data/lib/solar_terms_24/db/2053.json +26 -0
- data/lib/solar_terms_24/db/2054.json +26 -0
- data/lib/solar_terms_24/db/2055.json +26 -0
- data/lib/solar_terms_24/db/2056.json +26 -0
- data/lib/solar_terms_24/db/2057.json +26 -0
- data/lib/solar_terms_24/db/2058.json +26 -0
- data/lib/solar_terms_24/db/2059.json +26 -0
- data/lib/solar_terms_24/db/2060.json +26 -0
- data/lib/solar_terms_24/db/2061.json +26 -0
- data/lib/solar_terms_24/db/2062.json +26 -0
- data/lib/solar_terms_24/db/2063.json +26 -0
- data/lib/solar_terms_24/db/2064.json +26 -0
- data/lib/solar_terms_24/db/2065.json +26 -0
- data/lib/solar_terms_24/db/2066.json +26 -0
- data/lib/solar_terms_24/db/2067.json +26 -0
- data/lib/solar_terms_24/db/2068.json +26 -0
- data/lib/solar_terms_24/db/2069.json +26 -0
- data/lib/solar_terms_24/db/2070.json +26 -0
- data/lib/solar_terms_24/db/2071.json +26 -0
- data/lib/solar_terms_24/db/2072.json +26 -0
- data/lib/solar_terms_24/db/2073.json +26 -0
- data/lib/solar_terms_24/db/2074.json +26 -0
- data/lib/solar_terms_24/db/2075.json +26 -0
- data/lib/solar_terms_24/db/2076.json +26 -0
- data/lib/solar_terms_24/db/2077.json +26 -0
- data/lib/solar_terms_24/db/2078.json +26 -0
- data/lib/solar_terms_24/db/2079.json +26 -0
- data/lib/solar_terms_24/db/2080.json +26 -0
- data/lib/solar_terms_24/db/2081.json +26 -0
- data/lib/solar_terms_24/db/2082.json +26 -0
- data/lib/solar_terms_24/db/2083.json +26 -0
- data/lib/solar_terms_24/db/2084.json +26 -0
- data/lib/solar_terms_24/db/2085.json +26 -0
- data/lib/solar_terms_24/db/2086.json +26 -0
- data/lib/solar_terms_24/db/2087.json +26 -0
- data/lib/solar_terms_24/db/2088.json +26 -0
- data/lib/solar_terms_24/db/2089.json +26 -0
- data/lib/solar_terms_24/db/2090.json +26 -0
- data/lib/solar_terms_24/db/2091.json +26 -0
- data/lib/solar_terms_24/db/2092.json +26 -0
- data/lib/solar_terms_24/db/2093.json +26 -0
- data/lib/solar_terms_24/db/2094.json +26 -0
- data/lib/solar_terms_24/db/2095.json +26 -0
- data/lib/solar_terms_24/db/2096.json +26 -0
- data/lib/solar_terms_24/db/2097.json +26 -0
- data/lib/solar_terms_24/db/2098.json +26 -0
- data/lib/solar_terms_24/db/2099.json +26 -0
- data/lib/solar_terms_24/db/2100.json +26 -0
- data/lib/solar_terms_24/horizons.rb +82 -0
- data/lib/solar_terms_24/locales/en.yml +25 -0
- data/lib/solar_terms_24/locales/ja.yml +25 -0
- data/lib/solar_terms_24/locales/ko.yml +25 -0
- data/lib/solar_terms_24/locales/vi.yml +25 -0
- data/lib/solar_terms_24/locales/zh-CN.yml +25 -0
- data/lib/solar_terms_24/locales/zh-TW.yml +25 -0
- data/lib/solar_terms_24/solar_term.rb +51 -0
- data/lib/solar_terms_24/solar_terms.rb +59 -0
- data/lib/solar_terms_24/version.rb +5 -0
- data/lib/solar_terms_24.rb +12 -0
- data/sig/horizons_solar_terms.rbs +4 -0
- metadata +382 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0f15bcb96c0c6c3df06a9dd6ee78674ec3989e6145b80395f85c5eb5d8066d79
|
4
|
+
data.tar.gz: 9d1c839c510ca6a35fb0c76965e08b7e3b27921cf7c0a95ab9d2d7712081026d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 207af75cae0041c4f8924122e5e3dad13bc5ce2d8f9114059a5b716451f0e23a49919a3b1dfd55d69b2d7ff61a49e8e068dcf4c7ac9f1132cb407c0e82c786f0
|
7
|
+
data.tar.gz: d0f40428a096d8a58afdc0a2b256ecb73ed5ba3e1e09ff4e9002b9a03fc56c63edd30a7a51e6096e3613b3c2bd48c4cd812028bf8e9400990842d369a41e4b2c
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: single_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Layout/LineLength:
|
13
|
+
Enabled: false
|
14
|
+
Max: 120
|
15
|
+
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Metrics/AbcSize:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Lint/ToJSON:
|
26
|
+
Enabled: false
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
solar_terms_24 (1.0.0)
|
5
|
+
faraday (~> 2.0)
|
6
|
+
i18n (~> 1.0)
|
7
|
+
thor (~> 1.0)
|
8
|
+
tzinfo (~> 2.0.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
ast (2.4.2)
|
14
|
+
concurrent-ruby (1.1.10)
|
15
|
+
debug (1.7.1)
|
16
|
+
irb (>= 1.5.0)
|
17
|
+
reline (>= 0.3.1)
|
18
|
+
diff-lcs (1.5.0)
|
19
|
+
faraday (2.7.2)
|
20
|
+
faraday-net_http (>= 2.0, < 3.1)
|
21
|
+
ruby2_keywords (>= 0.0.4)
|
22
|
+
faraday-net_http (3.0.2)
|
23
|
+
i18n (1.12.0)
|
24
|
+
concurrent-ruby (~> 1.0)
|
25
|
+
io-console (0.5.11)
|
26
|
+
irb (1.5.1)
|
27
|
+
reline (>= 0.3.0)
|
28
|
+
json (2.6.3)
|
29
|
+
parallel (1.22.1)
|
30
|
+
parser (3.1.3.0)
|
31
|
+
ast (~> 2.4.1)
|
32
|
+
rainbow (3.1.1)
|
33
|
+
rake (13.0.6)
|
34
|
+
regexp_parser (2.6.1)
|
35
|
+
reline (0.3.1)
|
36
|
+
io-console (~> 0.5)
|
37
|
+
rexml (3.2.5)
|
38
|
+
rspec (3.12.0)
|
39
|
+
rspec-core (~> 3.12.0)
|
40
|
+
rspec-expectations (~> 3.12.0)
|
41
|
+
rspec-mocks (~> 3.12.0)
|
42
|
+
rspec-core (3.12.0)
|
43
|
+
rspec-support (~> 3.12.0)
|
44
|
+
rspec-expectations (3.12.1)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.12.0)
|
47
|
+
rspec-mocks (3.12.1)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.12.0)
|
50
|
+
rspec-support (3.12.0)
|
51
|
+
rubocop (1.41.1)
|
52
|
+
json (~> 2.3)
|
53
|
+
parallel (~> 1.10)
|
54
|
+
parser (>= 3.1.2.1)
|
55
|
+
rainbow (>= 2.2.2, < 4.0)
|
56
|
+
regexp_parser (>= 1.8, < 3.0)
|
57
|
+
rexml (>= 3.2.5, < 4.0)
|
58
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
59
|
+
ruby-progressbar (~> 1.7)
|
60
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
61
|
+
rubocop-ast (1.24.0)
|
62
|
+
parser (>= 3.1.1.0)
|
63
|
+
ruby-progressbar (1.11.0)
|
64
|
+
ruby2_keywords (0.0.5)
|
65
|
+
thor (1.2.1)
|
66
|
+
tzinfo (2.0.5)
|
67
|
+
concurrent-ruby (~> 1.0)
|
68
|
+
unicode-display_width (2.3.0)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
debug (~> 1.0)
|
75
|
+
rake (~> 13.0)
|
76
|
+
rspec (~> 3.0)
|
77
|
+
rubocop (~> 1.21)
|
78
|
+
solar_terms_24!
|
79
|
+
|
80
|
+
BUNDLED WITH
|
81
|
+
2.3.7
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Kevin Luo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
# SolarTerms24
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
`solar_terms_24` calculates and collects 24 solar terms each year. It utilizes [NASA's JPL Horizons System API](https://ssd.jpl.nasa.gov/horizons/) to calculate the longitude of ecliptic data. Those solar terms’ times can be translated into different **timezone** or **languages**.
|
6
|
+
|
7
|
+
[Solar term](https://en.wikipedia.org/wiki/Solar_term)(節氣, 節気, 节气, 절기, Tiết khí) is any of twenty-four periods in traditional Chinese lunisolar calendars and still used by many East-Asia countries. The solar terms are also used to calculate [intercalary months](https://en.wikipedia.org/wiki/Intercalation_(timekeeping)).
|
8
|
+
|
9
|
+
This gem aims to solve 2 main problems while finding those solar terms times of each year:
|
10
|
+
|
11
|
+
### 1. Ecliptic time
|
12
|
+
|
13
|
+
The times of solar terms are decided by **the longitude of the earth on the ecliptic**, which changes every year. [NASA's JPL Horizons System API](https://ssd.jpl.nasa.gov/horizons/) provides accurate ecliptic data so this gem can precisely calculate the solar terms time. This gem already caches 1900-2100's data. I bet this should be enough; however, you can try to search any year and it will call API to do the calculation.
|
14
|
+
|
15
|
+
### 2. Timezone
|
16
|
+
|
17
|
+
The time of solar terms is different in different countries because of different timezones. You can specify the timezones and languages to address this internationalization issue.
|
18
|
+
|
19
|
+
This gem is inspired by a Python package [solarterms](https://github.com/kumkee/solarterms)
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Add this line to your application's Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'solar_terms_24'
|
27
|
+
```
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
$ bundle install
|
32
|
+
|
33
|
+
Or install it yourself as:
|
34
|
+
|
35
|
+
$ gem install solar_terms_24
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
### Shell
|
40
|
+
|
41
|
+
The simplest way to use is through the command line:
|
42
|
+
```bash
|
43
|
+
$ solar_terms_24 list 2022
|
44
|
+
# Minor Cold: 2022-01-05 09:14
|
45
|
+
# Major Cold: 2022-01-20 02:39
|
46
|
+
# Start Of Spring: 2022-02-03 20:50
|
47
|
+
# Spring Showers: 2022-02-18 16:43
|
48
|
+
# Awakening Of Insects: 2022-03-05 14:43
|
49
|
+
# Spring Equinox: 2022-03-20 15:33
|
50
|
+
# Pure Brightness: 2022-04-04 19:20
|
51
|
+
# Grain Rain: 2022-04-20 02:24
|
52
|
+
# Start Of Summer: 2022-05-05 12:25
|
53
|
+
# Grain Buds: 2022-05-21 01:22
|
54
|
+
# Grain In Ear: 2022-06-05 16:25
|
55
|
+
# Summer Solstice: 2022-06-21 09:13
|
56
|
+
# Minor Heat: 2022-07-07 02:38
|
57
|
+
# Major Heat: 2022-07-22 20:07
|
58
|
+
# Start Of Autumn: 2022-08-07 12:29
|
59
|
+
# End Of Heat: 2022-08-23 03:16
|
60
|
+
# White Dew: 2022-09-07 15:32
|
61
|
+
# Autumn Equinox: 2022-09-23 01:03
|
62
|
+
# Cold Dew: 2022-10-08 07:22
|
63
|
+
# Frost: 2022-10-23 10:35
|
64
|
+
# Start Of Winter: 2022-11-07 10:45
|
65
|
+
# Minor Snow: 2022-11-22 08:20
|
66
|
+
# Major Snow: 2022-12-07 03:46
|
67
|
+
# Winter Solstice: 2022-12-21 21:48
|
68
|
+
```
|
69
|
+
The default timezone is `UTC` and the language is `en` so it may be more useful if you specify them:
|
70
|
+
|
71
|
+
```bash
|
72
|
+
$ solar_terms_24 list 2022 --timezone=Asia/Taipei --lang=zh-TW
|
73
|
+
# 小寒: 2022-01-05 17:14
|
74
|
+
# 大寒: 2022-01-20 10:39
|
75
|
+
# 立春: 2022-02-04 04:50
|
76
|
+
# 雨水: 2022-02-19 00:43
|
77
|
+
# 驚蟄: 2022-03-05 22:43
|
78
|
+
# 春分: 2022-03-20 23:33
|
79
|
+
# 清明: 2022-04-05 03:20
|
80
|
+
# 穀雨: 2022-04-20 10:24
|
81
|
+
# 立夏: 2022-05-05 20:25
|
82
|
+
# 小滿: 2022-05-21 09:22
|
83
|
+
# 芒種: 2022-06-06 00:25
|
84
|
+
# 夏至: 2022-06-21 17:13
|
85
|
+
# 小暑: 2022-07-07 10:38
|
86
|
+
# 大暑: 2022-07-23 04:07
|
87
|
+
# 立秋: 2022-08-07 20:29
|
88
|
+
# 處暑: 2022-08-23 11:16
|
89
|
+
# 白露: 2022-09-07 23:32
|
90
|
+
# 秋分: 2022-09-23 09:03
|
91
|
+
# 寒露: 2022-10-08 15:22
|
92
|
+
# 霜降: 2022-10-23 18:35
|
93
|
+
# 立冬: 2022-11-07 18:45
|
94
|
+
# 小雪: 2022-11-22 16:20
|
95
|
+
# 大雪: 2022-12-07 11:46
|
96
|
+
# 冬至: 2022-12-22 05:48
|
97
|
+
```
|
98
|
+
### In code
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
year = 2022
|
102
|
+
solar_terms = SolarTerms24::SolarTerms.new(year)
|
103
|
+
solar_term = solar_terms.winter_solstice
|
104
|
+
solar_term.name
|
105
|
+
# => "Winter Solstice"
|
106
|
+
solar_term.date.strftime('%Y-%m-%d')
|
107
|
+
# => 2022-12-21
|
108
|
+
# => solar_term.date is a Date object
|
109
|
+
solar_term.datetime.strftime('%Y-%m-%d %H:%M:%S')
|
110
|
+
# => 2022-12-21 21:48:14
|
111
|
+
# => solar_term.datetime is a DateTime object
|
112
|
+
|
113
|
+
solar_terms = SolarTerms24::SolarTerms.new(year, timezone: 'Asia/Taipei', lang: 'zh-TW')
|
114
|
+
solar_term = solar_terms.winter_solstice
|
115
|
+
solar_term.name
|
116
|
+
# => "冬至"
|
117
|
+
solar_term.date.strftime('%Y-%m-%d')
|
118
|
+
# => 2022-12-22
|
119
|
+
solar_term.datetime.strftime('%Y-%m-%d %H:%M:%S')
|
120
|
+
# => "2022-12-22 05:48:14"
|
121
|
+
```
|
122
|
+
|
123
|
+
## Options
|
124
|
+
### Languages
|
125
|
+
|
126
|
+
These are the supported languages:
|
127
|
+
|
128
|
+
* en (English, default)
|
129
|
+
* ja (Japanese)
|
130
|
+
* ko (Korean)
|
131
|
+
* vi (Vietnamese)
|
132
|
+
* zh-CN (Simpified Chinese)
|
133
|
+
* zh-TW (Tranditional Chinese)
|
134
|
+
|
135
|
+
### Timezone
|
136
|
+
|
137
|
+
It uses the gem [tzinfo], so all timezones in [IANA Time Zone Database](http://www.iana.org/time-zones) are supported. For example,
|
138
|
+
* UTC (default)
|
139
|
+
* Asia/Ho_Chi_Minh
|
140
|
+
* Asia/Seoul
|
141
|
+
* Asia/Taipei
|
142
|
+
* Asia/Tokyo
|
143
|
+
|
144
|
+
Full list is [here](./Timezones.md)
|
145
|
+
|
146
|
+
## Development
|
147
|
+
|
148
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
149
|
+
|
150
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
151
|
+
|
152
|
+
## Contributing
|
153
|
+
|
154
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kevinluo201/solar_terms_24.
|
155
|
+
|
156
|
+
## License
|
157
|
+
|
158
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|