ffi-icu 0.4.2 → 0.4.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/ffi-icu/time_formatting.rb +4 -1
- data/lib/ffi-icu/version.rb +1 -1
- data/spec/time_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e05cacd8501af573e102abe908556c1ea0f2eb1990b560271890c9d0827feb09
|
4
|
+
data.tar.gz: 4c5433c4183b376548f20ff533311d1acc61035d395b63a35f8e89a387ca7d98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a40fa82617a2c16aa759b263e5153e4135b5844823666ac5d0b5d205b300819f3ac1cf10d5e8e9f9182c2357080e6ed6add40388287b308ef6eae645f052a38f
|
7
|
+
data.tar.gz: 4d34feb23961b844cc9701d09a52a806f375bc58b10a04622d2230d57a1a97cd015f004ed72239a039041e901d304deb4051f81400191981116b7b055ef8b15b
|
@@ -254,7 +254,10 @@ module ICU
|
|
254
254
|
|
255
255
|
# Either ensure the skeleton has, or does not have, am/pm, as appropriate
|
256
256
|
if ['h11', 'h12'].include?(@hour_cycle)
|
257
|
-
|
257
|
+
# Only actually append 'am/pm' if there is an hour in the format string
|
258
|
+
if skeleton_str =~ /[hHkKjJ]/ && !skeleton_str.include?('a')
|
259
|
+
skeleton_str << 'a'
|
260
|
+
end
|
258
261
|
else
|
259
262
|
skeleton_str.gsub!('a', '')
|
260
263
|
end
|
data/lib/ffi-icu/version.rb
CHANGED
data/spec/time_spec.rb
CHANGED
@@ -128,6 +128,12 @@ module ICU
|
|
128
128
|
expect(str).to_not match(/(am|pm)/i)
|
129
129
|
end
|
130
130
|
|
131
|
+
it 'does not include am/pm if time is not requested' do
|
132
|
+
t = Time.new(2021, 04, 01, 00, 05, 0, "+00:00")
|
133
|
+
str = TimeFormatting.format(t, time: :none, date: :short, locale: locale_name, zone: 'UTC', hour_cycle: 'h12')
|
134
|
+
expect(str).to_not match(/(am|pm|下午|上午)/i)
|
135
|
+
end
|
136
|
+
|
131
137
|
context '@hours keyword' do
|
132
138
|
before(:each) do
|
133
139
|
skip("Only works on ICU >= 67") if Lib.version.to_a[0] < 67
|