diff --git a/app/decorators/comment_decorator.rb b/app/decorators/comment_decorator.rb
index a03eea59c..149fca297 100644
--- a/app/decorators/comment_decorator.rb
+++ b/app/decorators/comment_decorator.rb
@@ -23,9 +23,9 @@ class CommentDecorator < ApplicationDecorator
def readable_publish_date
if created_at.year == Time.current.year
- created_at.strftime("%b %e")
+ created_at.strftime("%b %-e")
else
- created_at.strftime("%b %e '%y")
+ created_at.strftime("%b %-e '%y")
end
end
end
diff --git a/app/decorators/podcast_episode_decorator.rb b/app/decorators/podcast_episode_decorator.rb
index a959ee55b..1d3b5c797 100644
--- a/app/decorators/podcast_episode_decorator.rb
+++ b/app/decorators/podcast_episode_decorator.rb
@@ -14,9 +14,9 @@ class PodcastEpisodeDecorator < ApplicationDecorator
return "" unless published_at
if published_at.year == Time.current.year
- published_at.strftime("%b %e")
+ published_at.strftime("%b %-e")
else
- published_at.strftime("%b %e '%y")
+ published_at.strftime("%b %-e '%y")
end
end
diff --git a/app/helpers/date_helper.rb b/app/helpers/date_helper.rb
index e92821e91..f1cf013ca 100644
--- a/app/helpers/date_helper.rb
+++ b/app/helpers/date_helper.rb
@@ -3,7 +3,7 @@ module DateHelper
datetime = Time.zone.parse(datetime) if datetime.is_a?(String)
tag.time(
- datetime.strftime("%b %e#{', %Y' if show_year}"),
+ datetime.strftime("%b %-e#{', %Y' if show_year}"),
datetime: datetime.utc.iso8601,
class: "date#{'-no-year' unless show_year}",
)
diff --git a/app/models/article.rb b/app/models/article.rb
index cc840b6ea..e6ce90c9f 100644
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -407,9 +407,9 @@ class Article < ApplicationRecord
def readable_publish_date
relevant_date = displayable_published_at
if relevant_date && relevant_date.year == Time.current.year
- relevant_date&.strftime("%b %e")
+ relevant_date&.strftime("%b %-e")
else
- relevant_date&.strftime("%b %e '%y")
+ relevant_date&.strftime("%b %-e '%y")
end
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index b395a0197..d861f5a4c 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -134,9 +134,9 @@ class Comment < ApplicationRecord
def readable_publish_date
if created_at.year == Time.current.year
- created_at.strftime("%b %e")
+ created_at.strftime("%b %-e")
else
- created_at.strftime("%b %e '%y")
+ created_at.strftime("%b %-e '%y")
end
end
diff --git a/spec/decorators/podcast_episode_decorator_spec.rb b/spec/decorators/podcast_episode_decorator_spec.rb
index 061b72f3c..b23ac0882 100644
--- a/spec/decorators/podcast_episode_decorator_spec.rb
+++ b/spec/decorators/podcast_episode_decorator_spec.rb
@@ -55,13 +55,13 @@ RSpec.describe PodcastEpisodeDecorator, type: :decorator do
it "returns the correct date for a same year publication" do
published_at = Time.current
pe = build(:podcast_episode, published_at: published_at)
- expect(pe.decorate.readable_publish_date).to eq(published_at.strftime("%b %e"))
+ expect(pe.decorate.readable_publish_date).to eq(published_at.strftime("%b %-e"))
end
it "returns the correct date for a publication within a different year" do
published_at = 2.years.ago
pe = build(:podcast_episode, published_at: published_at)
- expect(pe.decorate.readable_publish_date).to eq(published_at.strftime("%b %e '%y"))
+ expect(pe.decorate.readable_publish_date).to eq(published_at.strftime("%b %-e '%y"))
end
end
diff --git a/spec/helpers/date_helper_spec.rb b/spec/helpers/date_helper_spec.rb
index 5869fa0aa..d3d687cbf 100644
--- a/spec/helpers/date_helper_spec.rb
+++ b/spec/helpers/date_helper_spec.rb
@@ -4,14 +4,14 @@ describe DateHelper do
describe ".local_date" do
it "renders date" do
time = Time.now.utc
- date = time.strftime("%b %e, %Y")
+ date = time.strftime("%b %-e, %Y")
tag = helper.local_date(time)
expect(tag).to eq ""
end
it "renders date without year" do
time = Time.now.utc
- date = time.strftime("%b %e")
+ date = time.strftime("%b %-e")
tag = helper.local_date(time, show_year: false)
expect(tag).to eq ""
end
diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb
index df51653d2..d25568d0a 100644
--- a/spec/models/article_spec.rb
+++ b/spec/models/article_spec.rb
@@ -600,7 +600,7 @@ RSpec.describe Article, type: :model do
it "does not show year in readable time if not current year" do
time_now = Time.current
article.published_at = time_now
- expect(article.readable_publish_date).to eq(time_now.strftime("%b %e"))
+ expect(article.readable_publish_date).to eq(time_now.strftime("%b %-e"))
end
it "shows year in readable time if not current year" do
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
index 049a9a484..de6a1c385 100644
--- a/spec/models/comment_spec.rb
+++ b/spec/models/comment_spec.rb
@@ -238,7 +238,7 @@ RSpec.describe Comment, type: :model do
describe "#readable_publish_date" do
it "does not show year in readable time if not current year" do
- expect(comment.readable_publish_date).to eq(comment.created_at.strftime("%b %e"))
+ expect(comment.readable_publish_date).to eq(comment.created_at.strftime("%b %-e"))
end
it "shows year in readable time if not current year" do