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.localeData is not a function #82

Open
programmeranamul opened this issue Aug 30, 2022 · 7 comments
Open

moment.localeData is not a function #82

programmeranamul opened this issue Aug 30, 2022 · 7 comments

Comments

@programmeranamul
Copy link

image

image

I am working on a sveltekit project. When I am trying to import moment-hijri, it says to me "moment.localeData is not a function". But It's working fine in my sapper project. How can I solve this?

@mahmodHammad
Copy link

Hi @programmeranamul

I'm facing same issue, have you managed to solve it?

@MohammedSaberMohammed
Copy link

@programmeranamul @mahmodHammad I'm facing the same issue, any clue on how to solve this issue ?

@MiladRST
Copy link

MiladRST commented Oct 23, 2023

I am also facing the same issue in my Vue JS Project. Does anybody has solved it?

@programmeranamul
Copy link
Author

programmeranamul commented Oct 23, 2023 via email

@MiladRST
Copy link

Can you please give me an example of the changes?

@MiladRST
Copy link

MiladRST commented Oct 23, 2023

based on @programmeranamul opinion, I've changed the moment-hijri.js core file available in node_modules/moment-hijri. I only changed moment to moment/moment.
Here is what I've done : line 12 to 22
`
/* global define */

if (typeof define === 'function' && define.amd) {
	define(['moment/moment'], function (moment) {
		root.moment = factory(moment)
		return root.moment
	})
} else if (typeof exports === 'object') {
	module.exports = factory(require('moment/moment'))
} else {
	root.moment = factory(root.moment)
}

`

@mdbaniani
Copy link

based on @programmeranamul opinion, I've changed the moment-hijri.js core file available in node_modules/moment-hijri. I only changed moment to moment/moment. Here is what I've done : line 12 to 22 ` /* global define */

if (typeof define === 'function' && define.amd) {
	define(['moment/moment'], function (moment) {
		root.moment = factory(moment)
		return root.moment
	})
} else if (typeof exports === 'object') {
	module.exports = factory(require('moment/moment'))
} else {
	root.moment = factory(root.moment)
}

`

can this be turned into a PR so that the issue can be permanently solved? it has been 2 years since the last update of this repo

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

5 participants