mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Merge pull request #2487 from aignatov-bio/ai-sci-4464-fix-timezone-when-import-datetime
Fix timezone when import datetime [SCI-4464]
This commit is contained in:
commit
89e4a73fbb
1 changed files with 2 additions and 1 deletions
|
@ -24,7 +24,8 @@ class RepositoryDateTimeValue < RepositoryDateTimeValueBase
|
|||
|
||||
def self.import_from_text(text, attributes, options = {})
|
||||
date_format = (options.dig(:user, :settings, :date_format) || Constants::DEFAULT_DATE_FORMAT).gsub(/%-/, '%') + ' %H:%M'
|
||||
new(attributes.merge(data: DateTime.strptime(text, date_format)))
|
||||
Time.zone = options.dig(:user, :settings, :time_zone) || 'UTC'
|
||||
new(attributes.merge(data: Time.zone.strptime(text, date_format)))
|
||||
rescue ArgumentError
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue