Skip to content

Commit 26e7e61

Browse files
Merge branch '7.4' into 8.0
* 7.4: (28 commits) [Console] Rename `#[Input]` to `#[MapInput]` [FrameworkBundle] Fix support of dumping workflow when workflow is decorated by TraceableWorkflow [JsonStreamer] Fix documentation link in README [Meta] Better exception when symfony link cannot read a JSON [Form] Add new `active_at`, `not_active_at` and `legal_tender` options to `CurrencyType` [Intl] Support time in generated data in currencies validity [Validator] Improve and complete Japanese translations [HtmlSanitizer] Remove redundant assignment to promoted property $config in constructor [Validator] Fix Polish translation for word count validation message [DependencyInjection][Routing] Deprecate XML configuration format [Validator] Review and fix Czech translation [DependencyInjection][Routing] Handle declaring services and routes using PHP arrays that follow the same shape as corresponding yaml files [Mailer][MailJet] Fix forbidden headers case-sensitive comparison [DependencyInjection][Config][Routing] Deprecate using `$this` or the internal scope of the loader from PHP config files [Config] Add array-shapes to generated config builders [DependencyInjection] Handle returning arrays and config-builders from config files [WebProfilerBundle] Simplify toolbar CSS do not use deprecated PHPUnit features replace PHPUnit annotation with attribute [Serializer] xml empty array encoding ...
2 parents 1d770fc + 130a744 commit 26e7e61

File tree

3 files changed

+700
-699
lines changed

3 files changed

+700
-699
lines changed

Currencies.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ private static function isDateActive(string $country, string $currency, array $c
225225
throw new \RuntimeException("Cannot check whether the currency $currency is active or not in $country because they are no validity dates available.");
226226
}
227227

228-
$from = \DateTimeImmutable::createFromFormat('Y-m-d', $currencyMetadata['from']);
228+
$from = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s', $currencyMetadata['from'], new \DateTimeZone('Etc/UTC'));
229229

230230
if (\array_key_exists('to', $currencyMetadata)) {
231-
$to = \DateTimeImmutable::createFromFormat('Y-m-d', $currencyMetadata['to']);
231+
$to = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s', $currencyMetadata['to'], new \DateTimeZone('Etc/UTC'));
232232
} else {
233233
$to = null;
234234
}

Data/Generator/CurrencyDataGenerator.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ private function generateCurrencyMap(mixed $supplementalDataBundle): array
165165
}
166166

167167
if (\array_key_exists('from', $metadata)) {
168-
$metadata['from'] = self::icuPairToDate($metadata['from']);
168+
$metadata['from'] = self::icuPairToDatetimeString($metadata['from']);
169169
}
170170

171171
if (\array_key_exists('to', $metadata)) {
172-
$metadata['to'] = self::icuPairToDate($metadata['to']);
172+
$metadata['to'] = self::icuPairToDatetimeString($metadata['to']);
173173
}
174174

175175
if (\array_key_exists('tender', $metadata)) {
@@ -225,7 +225,7 @@ private function generateNumericToAlpha3Mapping(array $alpha3ToNumericMapping):
225225
*
226226
* @param array{0: int, 1: int} $pair
227227
*/
228-
private static function icuPairToDate(array $pair): string
228+
private static function icuPairToDatetimeString(array $pair): string
229229
{
230230
[$highBits32, $lowBits32] = $pair;
231231

@@ -241,12 +241,13 @@ private static function icuPairToDate(array $pair): string
241241
--$seconds;
242242
}
243243

244-
$datetime = \DateTimeImmutable::createFromFormat('U', $seconds, new \DateTimeZone('Etc/UTC'));
244+
// Note: Unlike the XML files, the date pair is already in UTC.
245+
$datetime = \DateTimeImmutable::createFromFormat('U', (string) $seconds, new \DateTimeZone('Etc/UTC'));
245246

246247
if (false === $datetime) {
247248
throw new \RuntimeException('Unable to parse ICU milliseconds pair.');
248249
}
249250

250-
return $datetime->format('Y-m-d');
251+
return $datetime->format('Y-m-d\TH:i:s');
251252
}
252253
}

0 commit comments

Comments
 (0)