astrolith 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/astrolith/input/datetime.rb +2 -1
- data/lib/astrolith/input/timezone.rb +18 -1
- data/lib/astrolith/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9de2dad823a451800d3b28a127f4a62bd201064ae5f71c691b311f54565e7f58
|
|
4
|
+
data.tar.gz: 823302415f7d0181769cef6e5e2e2861b683ab3178c587b9adda0d3d6080bb16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20bf05ae4bddb520d581d14fe6c6bba050c09fa24aa1e63e754434770256702e14888e1d575a21e97a79a77e9f81efa67f184dfa3bed83c1bb0c2998b867a2e2
|
|
7
|
+
data.tar.gz: 47d8e9b4e5b80ce48f29aa508be87a1d5ffe8009d788301f1d482b38eb1f821c35859c315f25cd151f4f778de86f08702de4d347f5154308f73b65c0fefe30be
|
|
@@ -22,7 +22,8 @@ module Astrolith
|
|
|
22
22
|
# Convert to Julian Day Number for Swiss Ephemeris
|
|
23
23
|
def to_julian_day(timezone_offset = 0)
|
|
24
24
|
# Adjust for timezone offset (in hours)
|
|
25
|
-
|
|
25
|
+
# Convert hours to days for DateTime arithmetic (DateTime - number treats number as days)
|
|
26
|
+
adjusted_time = @datetime - Rational(timezone_offset, 24)
|
|
26
27
|
|
|
27
28
|
# Use Swiss Ephemeris to calculate Julian Day
|
|
28
29
|
# swe_julday takes 4 arguments: year, month, day, hour (as decimal)
|
|
@@ -65,7 +65,24 @@ module Astrolith
|
|
|
65
65
|
return @offset if @offset
|
|
66
66
|
|
|
67
67
|
if @timezone.is_a?(TZInfo::Timezone) && @datetime
|
|
68
|
-
|
|
68
|
+
# Use periods_for_local to handle DST transitions
|
|
69
|
+
periods = @timezone.periods_for_local(@datetime)
|
|
70
|
+
|
|
71
|
+
if periods.empty?
|
|
72
|
+
# Invalid local time (spring forward) - the time doesn't exist
|
|
73
|
+
# Use the period after the transition
|
|
74
|
+
period = @timezone.period_for_utc(@datetime.to_time.utc)
|
|
75
|
+
elsif periods.size == 1
|
|
76
|
+
# Normal case - unambiguous local time
|
|
77
|
+
period = periods.first
|
|
78
|
+
else
|
|
79
|
+
# Ambiguous local time (fall back) - the time occurs twice
|
|
80
|
+
# Choose the first period (DST/summer time) by default
|
|
81
|
+
# This matches common expectations: if someone says "1:30 AM" on a fall-back day,
|
|
82
|
+
# they likely mean the first occurrence (before clocks fall back)
|
|
83
|
+
period = periods.first
|
|
84
|
+
end
|
|
85
|
+
|
|
69
86
|
period.utc_total_offset
|
|
70
87
|
else
|
|
71
88
|
0
|
data/lib/astrolith/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: astrolith
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Go-pye
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-02-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: swe4r
|