relaton 3.1.16 → 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 +16 -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
|
|
@@ -35,3 +38,16 @@ module Relaton
|
|
|
35
38
|
end
|
|
36
39
|
end
|
|
37
40
|
end
|
|
41
|
+
|
|
42
|
+
# lutaml's format-serializer table resolves Date-typed attributes by
|
|
43
|
+
# walking the class hierarchy to the BASE Type::Date entry, whose static
|
|
44
|
+
# serialize truncates ::DateTime to "YYYY-MM-DDZ" — a subclass's serialize
|
|
45
|
+
# override is never consulted. Register this subclass explicitly so
|
|
46
|
+
# Validity#to_xml honors the precision-preserving serialization above
|
|
47
|
+
# (relaton#636).
|
|
48
|
+
if defined?(Lutaml::Xml::Type::Serializers)
|
|
49
|
+
Lutaml::Model::Type::Value.register_format_type_serializer(
|
|
50
|
+
:xml, Relaton::Bib::PlainDate,
|
|
51
|
+
to: ->(inst) { Relaton::Bib::PlainDate.serialize(inst.value) }
|
|
52
|
+
)
|
|
53
|
+
end
|
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
|