Skip to content

Instantly share code, notes, and snippets.

@js2me
Created October 11, 2017 08:23
Show Gist options
  • Save js2me/c02b3a7cbf483c1c85506b6eb98a5759 to your computer and use it in GitHub Desktop.
Save js2me/c02b3a7cbf483c1c85506b6eb98a5759 to your computer and use it in GitHub Desktop.
moment feature! get current week number in the current month
let moment = require('moment-timezone') || require('moment');
moment.prototype.weekOfMonth = function weekOfMonth(m) { // eslint-disable-line
return this.week() - moment(this).startOf('month').week() + 1;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment