P
P
pavelkunyavskiy2018-02-12 15:03:33
JavaScript
pavelkunyavskiy, 2018-02-12 15:03:33

Why is date-fns example code not working with Vue?

I took the example directly from the main page, but it does not work in
Computed

import { format, formatDistance, formatRelative, subDays } from 'date-fns'
formatDistance(subDays(new Date(), 3), new Date())

I have in Computed
import { formatDistance, subDays } from 'date-fns'

formattedValue () {
      return formatDistance(subDays(new Date(), 3), new Date())
    }

MistakeObject(...) is not a function

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question