Closed rastographics closed 7 years ago
Linking to the matching SO post so other people can find it: http://stackoverflow.com/questions/39813233/how-do-you-use-twix-momentjs-with-typescript
It seems that the given answer no longer works. Are there by any chance any updates on this topic? Regardless, thanks for the great library! :)
I'm unfortunately just not a TypeScript guy, so I don't know how to help. If you do find a solution, please post it here.
Use the following to get things up and running with Angular 2+ or Ionic 2+:
import moment from "moment";
import "twix";
Hope this helps someone! It might be a good addition to: http://isaaccambron.com/twix.js/docs.html#getting-started
I am using Typescript and Angular 10+ and after installing these versions of twix types, moment and twix. "@types/twix": "^0.6.38", "moment": "^2.29.1", "twix": "^1.3.0",
and importing them like this.
import * as moment from 'moment'; import 'twix';
and this works with Dates.
moment(startDate).twix(endDate, {allDay: true}).format();
Has anyone used twix with typescript and could share how you got it working? I have
Moment is working fine, intellisense and everything. Twix module imports fine and if I type twix. I can see the interface pop up.
But I get "Property twix does not exist on Moment" when I try to use moment(date).twix()