Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ private function generateCurrencyMap(mixed $supplementalDataBundle): array
}

if (\array_key_exists('from', $metadata)) {
$metadata['from'] = self::icuPairToDate($metadata['from']);
$metadata['from'] = self::icuPairToDatetimeString($metadata['from']);
}

if (\array_key_exists('to', $metadata)) {
$metadata['to'] = self::icuPairToDate($metadata['to']);
$metadata['to'] = self::icuPairToDatetimeString($metadata['to']);
}

if (\array_key_exists('tender', $metadata)) {
Expand Down Expand Up @@ -229,7 +229,7 @@ private function generateNumericToAlpha3Mapping(array $alpha3ToNumericMapping):
*
* @param array{0: int, 1: int} $pair
*/
private static function icuPairToDate(array $pair): string
private static function icuPairToDatetimeString(array $pair): string
{
[$highBits32, $lowBits32] = $pair;

Expand All @@ -245,12 +245,13 @@ private static function icuPairToDate(array $pair): string
--$seconds;
}

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

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

return $datetime->format('Y-m-d');
return $datetime->format('Y-m-d\TH:i:s');
}
}
Loading
Loading