dayjs-module icon indicating copy to clipboard operation
dayjs-module copied to clipboard

Day JS in Nuxt guessing timezone using tz.guess() not a function

Open sts-ryan-holton opened this issue 2 years ago • 0 comments

I'm using the @nuxtjs/dayjs module v1.4.1 in my Nuxt 2 project. I need to guess the user's timezone and set a datetime in their timezone. When I try to run my JS, I get an error telling me it's not a function, what am I missing?

// Day JS config
dayjs: {
  locales: ['en'],
  defaultLocale: 'en',
  plugins: [
    'utc',
    'timezone',
    'relativeTime',
    'advancedFormat',
    'localizedFormat',
    'customParseFormat'
  ]
},

Called like in a function:

this.$dayjs().tz.guess()

returns error:

this.$dayjs(...).tz.guess is not a function

sts-ryan-holton avatar Feb 22 '23 16:02 sts-ryan-holton