xsoh / moment-hijri

A Hijri calendar (Based on Umm al-Qura calculations) plugin for moment.js
http://momentjs.com/docs/#/plugins/hijri/
MIT License
200 stars 82 forks source link

moment.localeData is not a function #82

Open programmeranamul opened 1 year ago

programmeranamul commented 1 year ago

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 commented 1 year ago

Hi @programmeranamul

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

MohammedSaberMohammed commented 1 year ago

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

MiladRST commented 8 months ago

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

programmeranamul commented 8 months ago

Yes. I had solved the issue. I had changed some code in moment-hijri core file.

On Mon, Oct 23, 2023, 4:02 PM Milad Rastin @.***> wrote:

I am also facing the same issue. Does anybody has solved it?

— Reply to this email directly, view it on GitHub https://github.com/xsoh/moment-hijri/issues/82#issuecomment-1774844762, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASKRIKDUM5QFTUHSIW25DTTYAY6CZAVCNFSM5775AWKKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXGQ4DINBXGYZA . You are receiving this because you were mentioned.Message ID: @.***>

MiladRST commented 8 months ago

Can you please give me an example of the changes?

MiladRST commented 8 months ago

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 commented 3 months ago

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