ACGC / moment-islamic-civil

A Hijri calendar (Based on islamic civil calculation) plugin for moment.js.
MIT License
3 stars 3 forks source link

NPM install an empty file #1

Open ProtocolNebula opened 5 years ago

ProtocolNebula commented 5 years ago

If I install from npm or yarn, it create a moment-civil.js file empty.

_I'm using into angular application and I can't load the file with import * as moment from ... if not in node_modules folder (it crash, I don't know why, but if I fill the file in node_modules it works like a charm)._

Can you please update the NPM repository?

If you can't, I can try to make a new one.

TIP if you need to use in TypeScript project:

declare var require: any; // My tsconfig not work with types node
const moment = require('./path/to/moment-islamic-civil/moment-civil');

// ...
// Your code
moment.locale('en'); // Force english location, else will show hijri numbers instead english
const dateMoment = moment(date, format);
// More code
Noitidart commented 3 years ago

Try installing straight from github:

npm i github:ACGC/moment-islamic-civil#master

I couldn't figure out how to use this though. it doesnt seem to work with moment-timezone.

ProtocolNebula commented 3 years ago

Thanks, I didn't even know/remember that npm was capable to install a dependency from GitHub.

I just copied it to the project and used it as an internal module.

Noitidart commented 3 years ago

Oh thanks for sharing. I'm trying to find a hijri calendar that works with moment-timezone. I don't think this one does.

ProtocolNebula commented 3 years ago

I don't know anyone, but maybe you can found one for an alternative like Day.js, because the moment library is desecrated.

If you found an alternative, will be glad to know it.

Luck!

Noitidart commented 3 years ago

Thasks! I was thinking of moving to https://github.com/arabiaweather/hijri-date/blob/master/hijri-date.js as that doesn't mess with moment, so i can still use moment-timezone and then just get the Islamic year day and month name.