mirror of https://github.com/YunYouJun/valaxy
fix: valaxy new date time format 24h, close #158
This commit is contained in:
parent
b8e471770f
commit
4c559f9860
|
@ -8,6 +8,7 @@
|
|||
"build:spa": "valaxy build",
|
||||
"build:ssg": "valaxy build --ssg",
|
||||
"dev": "nodemon -w \"../../packages/valaxy/dist/*.cjs\" --exec \"valaxy .\"",
|
||||
"new": "valaxy new",
|
||||
"rss": "valaxy rss",
|
||||
"serve": "vite preview"
|
||||
},
|
||||
|
|
|
@ -44,12 +44,14 @@ Options:
|
|||
"build:spa": "valaxy build",
|
||||
"build:ssg": "valaxy build --ssg",
|
||||
"dev": "valaxy .",
|
||||
"new": "valaxy new",
|
||||
"rss": "valaxy rss"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
譬如通过 `npm run dev` 启动项目,通过 `npm run build` 可以在构建生成 ssg 站点后,再构建 RSS 源。
|
||||
通过 `pnpm new post-title` 在 `posts` 文件夹下新建一个名为 `post-title` 的文章。
|
||||
|
||||
### 全局安装
|
||||
|
||||
|
|
|
@ -38,6 +38,6 @@ export const newPost = (cli: Argv<{}>) => {
|
|||
layout,
|
||||
path,
|
||||
} as CreatePostParams)
|
||||
consola.success(`[valaxy new]: successfully generated file ${magenta(filename)}}`)
|
||||
consola.success(`[valaxy new]: successfully generated file ${magenta(filename)}`)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -52,5 +52,7 @@ async function genLayoutTemplate({
|
|||
if (!template)
|
||||
template = defaultPostTemplate
|
||||
|
||||
return render(template, { title, layout, date: date ? dayjs().format('YYYY-MM-DD hh:mm:ss') : '' })
|
||||
// 24h format
|
||||
const dateFormat = 'YYYY-MM-DD HH:mm:ss'
|
||||
return render(template, { title, layout, date: date ? dayjs().format(dateFormat) : '' })
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue