[opt] date
This commit is contained in:
parent
20a93e4c01
commit
c058219302
|
@ -118,7 +118,6 @@ function custom_inject() {
|
||||||
min: '<%- __('meta.date_suffix.min') %>',
|
min: '<%- __('meta.date_suffix.min') %>',
|
||||||
hour: '<%- __('meta.date_suffix.hour') %>',
|
hour: '<%- __('meta.date_suffix.hour') %>',
|
||||||
day: '<%- __('meta.date_suffix.day') %>',
|
day: '<%- __('meta.date_suffix.day') %>',
|
||||||
month: '<%- __('meta.date_suffix.month') %>',
|
|
||||||
},
|
},
|
||||||
root : '<%- config.root %>',
|
root : '<%- config.root %>',
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,19 +9,15 @@ const util = {
|
||||||
const minute = 1000 * 60
|
const minute = 1000 * 60
|
||||||
const hour = minute * 60
|
const hour = minute * 60
|
||||||
const day = hour * 24
|
const day = hour * 24
|
||||||
const month = day * 30
|
|
||||||
|
|
||||||
let result
|
let result
|
||||||
if (more) {
|
if (more) {
|
||||||
const monthCount = dateDiff / month
|
|
||||||
const dayCount = dateDiff / day
|
const dayCount = dateDiff / day
|
||||||
const hourCount = dateDiff / hour
|
const hourCount = dateDiff / hour
|
||||||
const minuteCount = dateDiff / minute
|
const minuteCount = dateDiff / minute
|
||||||
|
|
||||||
if (monthCount > 12) {
|
if (dayCount > 7) {
|
||||||
result = null
|
result = null
|
||||||
} else if (monthCount >= 1) {
|
|
||||||
result = parseInt(monthCount) + ' ' + stellar.config.date_suffix.month
|
|
||||||
} else if (dayCount >= 1) {
|
} else if (dayCount >= 1) {
|
||||||
result = parseInt(dayCount) + ' ' + stellar.config.date_suffix.day
|
result = parseInt(dayCount) + ' ' + stellar.config.date_suffix.day
|
||||||
} else if (hourCount >= 1) {
|
} else if (hourCount >= 1) {
|
||||||
|
|
Loading…
Reference in New Issue