From c058219302094d79c68620f2c38caaa865f49415 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 7 Feb 2024 16:27:35 +0800 Subject: [PATCH] [opt] date --- layout/_partial/scripts/index.ejs | 1 - source/js/main.js | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/layout/_partial/scripts/index.ejs b/layout/_partial/scripts/index.ejs index 58b1246..04a13bb 100644 --- a/layout/_partial/scripts/index.ejs +++ b/layout/_partial/scripts/index.ejs @@ -118,7 +118,6 @@ function custom_inject() { min: '<%- __('meta.date_suffix.min') %>', hour: '<%- __('meta.date_suffix.hour') %>', day: '<%- __('meta.date_suffix.day') %>', - month: '<%- __('meta.date_suffix.month') %>', }, root : '<%- config.root %>', }; diff --git a/source/js/main.js b/source/js/main.js index 41909e9..6abafdb 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -9,19 +9,15 @@ const util = { const minute = 1000 * 60 const hour = minute * 60 const day = hour * 24 - const month = day * 30 let result if (more) { - const monthCount = dateDiff / month const dayCount = dateDiff / day const hourCount = dateDiff / hour const minuteCount = dateDiff / minute - if (monthCount > 12) { + if (dayCount > 7) { result = null - } else if (monthCount >= 1) { - result = parseInt(monthCount) + ' ' + stellar.config.date_suffix.month } else if (dayCount >= 1) { result = parseInt(dayCount) + ' ' + stellar.config.date_suffix.day } else if (hourCount >= 1) {