jsmreese / moment-duration-format

Format function plugin for the Moment Duration object.
MIT License
967 stars 121 forks source link

Property 'format' does not exist on type 'Duration' #149

Open omaracrystal opened 3 years ago

omaracrystal commented 3 years ago

Hello! I need some help trying to figure out what I am missing here to make this package work.

What I've done: I have installed both moment and this package "moment": "^2.24.0", "moment-duration-format": "^2.3.2",

My Code:

import moment from 'moment';
import momentDurationFormatSetup from 'moment-duration-format';

function durationFormatter(minutes): string {
  momentDurationFormatSetup(moment);
  return moment.duration(minutes, "minutes").format();
}

Getting this error: Property 'format' does not exist on type 'Duration'

ricardo-dlc commented 3 years ago

Seems that you are using TypeScript. Did you installed the @types/moment-duration-format for this lib?

npm i @types/moment-duration-format -D