mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-08 12:07:06 +08:00
fix: 修复 说说时间 timezone bug
This commit is contained in:
@@ -3,6 +3,14 @@
|
||||
const { truncateContent, postDesc } = require('../common/postDesc')
|
||||
const { prettyUrls } = require('hexo-util')
|
||||
const crypto = require('crypto')
|
||||
const moment = require('moment-timezone')
|
||||
|
||||
hexo.extend.helper.register('getTimeZoneDate', date => {
|
||||
// This is a hack method, because hexo treats time as UTC time
|
||||
// so you need to manually convert the time zone
|
||||
const utcDate = moment.utc(date).format('YYYY-MM-DD HH:mm:ss')
|
||||
return moment.tz(utcDate, hexo.config.timezone).format('YYYY-MM-DD HH:mm:ss')
|
||||
})
|
||||
|
||||
hexo.extend.helper.register('truncate', truncateContent)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user