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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: effcf0f04d9b075586f9ee71ddd815359b9b531d1a4536ca8407e1465be17411
4
- data.tar.gz: f3305805c9aac14139c42a3e4fd0ffe972e60771f7a4cb64a86ff08c268f6c17
3
+ metadata.gz: 113616dfa3ea3bd048a0da27ab3400b267d4ba8f999761197a0f2c5032da109d
4
+ data.tar.gz: 428640dc9817a710305298130a02584ba779ec60fe3bce940e1ab78f648244d2
5
5
  SHA512:
6
- metadata.gz: 0d625297d44fc7ab8421a809ae76d6835220a0b1fe7af2faa8349b25a2a29db0e55f35e2a50c4a2aed5d3e894685b497fb5b29f945a89f5395f570b5b2085a2a
7
- data.tar.gz: 7f84119ab99a8fbebca57de249d51a36c9a7d13936ffc07ea94af5517b6e372f9236eeeea9ebbec4e6969a0e07a632a145241487c8e203f36bb624dd7bc7686c
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.new(t.to_i, p, p).to_datetime.to_time.utc
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).to_datetime.to_time.utc
623
+ ::Date.new($~[:year].to_i, $~[:month].to_i, p)
622
624
  else
623
- # Default to UTC when no timezone is specified
624
- t += " UTC" unless t.match?(/[+-]\d{2}:?\d{2}\s*$|Z\s*$/i)
625
- ::Time.parse t
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
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "3.1.17".freeze
2
+ VERSION = "3.1.18".freeze
3
3
  end
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.17
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-28 00:00:00.000000000 Z
11
+ date: 2026-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable