relaton 3.1.17 → 3.1.18
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/relaton/bib/hash_parser_v1.rb +13 -5
- data/lib/relaton/bib/model/type/plain_date.rb +3 -0
- data/lib/relaton/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: 113616dfa3ea3bd048a0da27ab3400b267d4ba8f999761197a0f2c5032da109d
|
|
4
|
+
data.tar.gz: 428640dc9817a710305298130a02584ba779ec60fe3bce940e1ab78f648244d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4217909b731782960e1f893172578e94c3ff483589d9800c0f4bc7fc9bb0420cf295c8d8c8a14464162d9bf09b36425e6ef4b570e39430b91b6f9244273a388a
|
|
7
|
+
data.tar.gz: 809b0d30b4d929a1dd336c7e43e00592b8b986648aca898f03a3dca53afdc514a068ec58f3076f24fb3de4c23f17576e8f9e1ea626e045c59a8231742c56ed5c
|
|
@@ -616,13 +616,21 @@ module Relaton
|
|
|
616
616
|
p = period == :ends ? -1 : 1
|
|
617
617
|
case t
|
|
618
618
|
when /^\d{4}$/
|
|
619
|
-
::Date
|
|
619
|
+
# Year and year-month inputs are date-only: keep ::Date
|
|
620
|
+
# precision (PlainDate serializes them as xs:date).
|
|
621
|
+
::Date.new(t.to_i, p, p)
|
|
620
622
|
when /^(?<year>\d{4})-(?<month>\d{1,2})$/
|
|
621
|
-
::Date.new($~[:year].to_i, $~[:month].to_i, p)
|
|
623
|
+
::Date.new($~[:year].to_i, $~[:month].to_i, p)
|
|
622
624
|
else
|
|
623
|
-
#
|
|
624
|
-
|
|
625
|
-
|
|
625
|
+
# Date-only strings stay ::Date (PlainDate keeps xs:date
|
|
626
|
+
# precision); strings with a time promote to ::Time/DateTime.
|
|
627
|
+
if t.match?(/\A\d{4}-\d{2}-\d{2}\s*(UTC|UTC\+00:00)?\s*$/i)
|
|
628
|
+
::Date.parse t
|
|
629
|
+
else
|
|
630
|
+
# Default to UTC when no timezone is specified
|
|
631
|
+
t += " UTC" unless t.match?(/[+-]\d{2}:?\d{2}\s*$|Z\s*$/i)
|
|
632
|
+
::Time.parse t
|
|
633
|
+
end
|
|
626
634
|
end
|
|
627
635
|
end
|
|
628
636
|
|
|
@@ -14,6 +14,9 @@ module Relaton
|
|
|
14
14
|
# String with a time component: parse as ::DateTime, keeping
|
|
15
15
|
# offset and precision (lutaml's Date cast truncates these).
|
|
16
16
|
return ::DateTime.parse(value) if value.is_a?(String) && value =~ /T\d{2}:\d{2}/
|
|
17
|
+
# ::Time objects (the hash parser's validity output) carry full
|
|
18
|
+
# precision: promote to ::DateTime instead of truncating.
|
|
19
|
+
return value.to_datetime if value.is_a?(::Time)
|
|
17
20
|
# ::DateTime objects already carry the caller's precision.
|
|
18
21
|
return value if value.is_a?(::DateTime)
|
|
19
22
|
# A string without a time component ("2018-04-15+05:30") is
|
data/lib/relaton/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.
|
|
4
|
+
version: 3.1.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|