Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add `local_time` gem to `spree_admin`

Damian Legawiec92f3b5a6dc32
diff --git a/admin/lib/spree/admin.rb b/admin/lib/spree/admin.rb
index fc094bde81..d2a1a2d7ba 100644
--- a/admin/lib/spree/admin.rb
+++ b/admin/lib/spree/admin.rb
@@ -11,6 +11,7 @@ require 'bootstrap'
require 'turbo-rails'
require 'stimulus-rails'
require 'inline_svg'
+require 'local_time'
require 'payment_icons'
require 'dartsass-rails'
require 'responders'
diff --git a/admin/spree_admin.gemspec b/admin/spree_admin.gemspec
index dc1fba606a..a10eb6dcd4 100644
--- a/admin/spree_admin.gemspec
+++ b/admin/spree_admin.gemspec
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
s.add_dependency 'dartsass-rails', '~> 0.5'
s.add_dependency 'importmap-rails'
s.add_dependency 'inline_svg', '~> 1.5'
+ s.add_dependency 'local_time', '~> 3.0'
s.add_dependency 'payment_icons'
s.add_dependency 'turbo-rails'
s.add_dependency 'stimulus-rails'
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rb
index 7fab0738e1..279dd5c3bd 100644
--- a/core/app/helpers/spree/base_helper.rb
+++ b/core/app/helpers/spree/base_helper.rb
@@ -157,12 +157,22 @@ module Spree
def pretty_time(time)
return '' if time.blank?
+ Spree::Deprecation.warn(<<-DEPRECATION, caller)
+ `BaseHelper#pretty_time` is deprecated and will be removed in Spree 6.0.
+ Please add `local_time` gem to your Gemfile and use `local_time(time)` instead
+ DEPRECATION
+
[I18n.l(time.to_date, format: :long), time.strftime('%l:%M %p %Z')].join(' ')
end
def pretty_date(date)
return '' if date.blank?
+ Spree::Deprecation.warn(<<-DEPRECATION, caller)
+ `BaseHelper#pretty_date` is deprecated and will be removed in Spree 6.0.
+ Please add `local_time` gem to your Gemfile and use `local_date(date)` instead
+ DEPRECATION
+
[I18n.l(date.to_date, format: :long)].join(' ')
end