diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 57f4819c0..a288ee64f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -108,13 +108,17 @@ module ApplicationHelper tag.time content || datetime, datetime: datetime, title: time.to_formatted_s, **options end - def humanized_duration(from, to) + def humanized_duration(from, to, compact: false) if to - from > 10.years duration = "forever" else duration = distance_of_time_in_words(from, to) end + if compact + duration = duration.gsub(/almost|about|over/, "").gsub(/less than a/, "<1").strip + end + datetime = from.iso8601 + "/" + to.iso8601 title = "#{from.strftime("%Y-%m-%d %H:%M")} to #{to.strftime("%Y-%m-%d %H:%M")}" diff --git a/app/javascript/src/javascripts/common.js b/app/javascript/src/javascripts/common.js index e0fc4d0c0..cc04ab125 100644 --- a/app/javascript/src/javascripts/common.js +++ b/app/javascript/src/javascripts/common.js @@ -9,8 +9,8 @@ $(function() { $("#hide-promotion-notice").on("click.danbooru", function(e) { $("#promotion-notice").hide(); - Cookie.put("hide_promotion_notice", "1", 1 * 24 * 60 * 60); - Cookie.put("hide_upgrade_account_notice", "1", 1 * 24 * 60 * 60); + Cookie.put("hide_final_promotion_notice", "1", 3 * 60 * 60); + Cookie.put("hide_upgrade_account_notice", "1", 7 * 24 * 60 * 60); e.preventDefault(); }); diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 778a3c143..7c6606f56 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -70,21 +70,14 @@
Danbooru Winter Sale! Gold and Platinum upgrades are 25% off from now until January 1st.
++ <%= tag.img src: "/images/padoru.gif", width: 24, height: 24 %> + Danbooru Winter Sale! Gold and Platinum upgrades are 25% off. Sale ends in <%= Time.use_zone("UTC") { humanized_duration(Time.zone.parse("2021-01-01"), Time.zone.now, compact: true) } %>. + <%= tag.img src: "/images/padoru.gif", width: 24, height: 24 %> +
<% end %>Upgrading your account gives you exclusive benefits and helps support