Fix Excell date parsing [SCI-10856]

This commit is contained in:
Martin Artnik 2024-07-09 13:34:40 +02:00
parent 0bdf220b20
commit 648b5be1b9
2 changed files with 4 additions and 1 deletions

View file

@ -264,6 +264,7 @@ class RepositoriesController < ApplicationController
parsed_file = ImportRepository::ParseRepository.new(
file: import_params[:file],
repository: @repository,
date_format: current_user.settings['date_format'],
session: session
)
if parsed_file.too_large?

View file

@ -60,7 +60,9 @@ class SpreadsheetParser
if cell.is_a?(Roo::Excelx::Cell::Number) && cell.format == 'General'
cell&.value&.to_d
elsif date_format && cell&.value.is_a?(Date)
cell&.value&.strftime(date_format)
cell&.value&.strftime(
"#{date_format} #{' %H:%M' if cell.value.is_a?(DateTime)}"
)
else
cell&.formatted_value
end