jamesplease / moment-business

Utilities for work days in Moment. (Western workweeks only.)
MIT License
100 stars 27 forks source link

Doesn't export for Node.JS #29

Closed JoeChapman closed 9 years ago

JoeChapman commented 9 years ago

moment-business.js does not export moment

jamesplease commented 9 years ago

Yup, intentionally. It's a plugin, so it modifies the original library.

You only need to require it in a single time in your entire node app. From then on, you can just require moment and access the API.

In other words, you might have...

// plugins.js

// Load up moment business!
require('moment-business');
// some-file.js
var moment = require('moment');

moment.weekDays(...);

Does that make sense, @JoeChapman ?

JoeChapman commented 9 years ago

Cheers @jmeas

jamesplease commented 9 years ago

:beers:

xgdgsc commented 8 years ago

@jmeas I' m a newbie in this area. I' m getting very confused on how to use this library in browser html and js. What should I use to call the function subtractWeekDays after including the js files in <script> tag as follows:

    <script type="text/javascript" src="js/node_modules/contained-periodic-values/dist/contained-periodic-values.min.js"></script>
    <script type="text/javascript" src="js/node_modules/nearest-periodic-value/dist/nearest-periodic-value.min.js"></script>
    <script type="text/javascript" src="js/node_modules/skipped-periodic-values/dist/skipped-periodic-values.min.js"></script>
    <script type="text/javascript" src="js/node_modules/moment-business/dist/moment-business.min.js"></script>

I would get business is not defined error if using business.subtractWeekDays. Thanks!

jamesplease commented 8 years ago

@xgdgsc , there is a bug that is attaching it to none on the window. This is my mistake – I'm sorry about that! I'll open a new issue and track fixing it there.

Update: Opened as #45