Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moment.duration is not a function #22

Open
kennetpostigo opened this issue Feb 22, 2018 · 3 comments
Open

Moment.duration is not a function #22

kennetpostigo opened this issue Feb 22, 2018 · 3 comments

Comments

@kennetpostigo
Copy link

Hey I ran into this error where the code compiles, but when I check the browser I get an error in the console saying that Moment.duration is not a function. Heres the code

MomentRe.Moment.subtract(
  ~duration=MomentRe.duration(7, `days),
  MomentRe.momentNow()
)

Heres the error:
screen shot 2018-02-22 at 10 37 29 am

@kennetpostigo
Copy link
Author

kennetpostigo commented Feb 22, 2018

Turns out this is b/c moment 1.3.x exports the module differently. So you have to change the moment bindings to use default:

[@bs.module "moment"] external momentNow : unit => t = "default";

I've gone ahead and rolled my own bindings and can confirm this is the way to fix it.

@jimexist
Copy link
Owner

@kennetpostigo, for now, the expected version of moment is "moment": "^2.20.1" as specified in package.json. You are using an old version. Do you think it is possible for you to upgrade?

If not, probably we need to figure out how to publish dual versioned bindings.

@baldurh
Copy link

baldurh commented Feb 12, 2019

@jimexist we have the same problem on my project and we have "moment": "2.22.2". I also created a fork of this and am using that at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants