@vuepress/plugin-last-updated

    If you use the default theme, you don't need to install this plugin, because the plugin is already included in the of VuePress, and you should use the themeConfig.lastUpdated option directly.

    Options

    • Type: (timestamp: number, lang: string) => string
    • Default: undefined

    By default, this plugin produces a 13-bit timestamp for each page, you can also pass in a transformer to convert it to any format that you want.

    1. const moment = require('moment');
    2. module.exports = {
    3. plugins: [
    4. [
    5. {
    6. transformer: (timestamp, lang) => {
    7. const moment = require('moment')
    8. moment.locale(lang)
    9. return moment(timestamp).fromNow()
    10. }
    11. ]
    12. }

    TIP

    Note that in VuePress, we follow this spec: W3C > Language tags in HTML and XML, so en-US uses hyphens (-) instead of underscores (_). Please make sure that the library you are using follows this spec, otherwise please convert it yourself.