xsoh/moment-hijri

moment.localeData is not a function

programmeranamul opened this issue · 7 comments

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?

Hi @programmeranamul

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

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

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

Can you please give me an example of the changes?

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)
}

`

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