Created
March 26, 2020 10:53
-
-
Save taschmidt/8859ab374e70c50716deae1309b3ec90 to your computer and use it in GitHub Desktop.
Typescript definition for moment-msdate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as moment from 'moment-timezone'; | |
| // moment-msdate doesn't provide strong types, so add them here | |
| declare module 'moment' { | |
| export function fromOADate(oaDate: number, offset?: (string | number)): moment.Moment; | |
| interface Moment { | |
| toOADate(): number; | |
| } | |
| } | |
| export * from 'moment-msdate'; |
Author
Man I haven't needed this in quite a while. I'm assuming you could save it as a .d.ts file and include it in your project and it should pick it up.
embarrassed to say, I finally gave up and did this
// @ts-ignore
const nowMS = nowMoment.toOADate(); // this function is bootstrapped onto the moment type by moment-msdate but this lib does not export strong types so we need to tell TS to ignore it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for doing this. How would you import/use this?