0

I'm trying to display an array of numbers

const days = [1, 7, 14, 30, 60]

in humanized form via vue-moment

it's working fine

{{ days | duration('humanize') }}
// 'a day'
// '7 days'
// '14 days'
// 'a month'
// '2 months'

Problem

I want 1 month instead of a month

How can i change that? I found this https://stackoverflow.com/a/31804664/6066886 answer, it implies changing the vue-moment config.

The docs at https://www.npmjs.com/package/vue-moment state that

vue-moment should respect any global Moment customizations, including i18n locales. For more info, check out http://momentjs.com/docs/#/customization/.

You can also pass a custom Moment object through with the plugin options. This technique is especially useful for overcoming the browserify locale bug demonstrated in the docs http://momentjs.com/docs/#/use-it/browserify/

But both of these would force me to install moment AND vue-moment, just to create a moment-config-object to pass into vue-moment. Or am i missing something?

I'm looking for a way to pass {M: '1 month'} in somewhere and be done with it. Isn't that possible?

( loading vue-moment with Vue.use(require('vue-moment')))

devman
  • 641
  • 1
  • 8
  • 26

1 Answers1

0

vue-moment already pulls in moment (you'll see moment in node_modules after installing vue-moment), so technically you're not adding a new dependency.

tony19
  • 125,647
  • 18
  • 229
  • 307