dist/gregorian.js
function setLocalOrSetUTC(increment, value, date) {
  var _incrementHandlers;

  var utc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';

  var incrementHandlers = (_incrementHandlers = {}, defineProperty(_incrementHandlers, MILLISECOND, function (date) {
    return new Date(date['set' + utc + 'Milliseconds'](value));
  }), defineProperty(_incrementHandlers, SECOND, function (date) {
    return new Date(date['set' + utc + 'Seconds'](value));
  }), defineProperty(_incrementHandlers, MINUTE, function (date) {
    return new Date(date['set' + utc + 'Minutes'](value));
  }), defineProperty(_incrementHandlers, HOUR, function (date) {
    return new Date(date['set' + utc + 'Hours'](value));
  }), defineProperty(_incrementHandlers, DATE, function (date) {
    return new Date(date['set' + utc + 'Date'](value));
  }), defineProperty(_incrementHandlers, DAY, function (date) {
    return new Date(date['set' + utc + 'Date'](date['get' + utc + 'Date']() - date['get' + utc + 'Day']() + (value - 1)));
  }), defineProperty(_incrementHandlers, WEEK, function (date) {
    var currentDay = date['get' + utc + 'Day']();
    var currentMilliseconds = date['get' + utc + 'Milliseconds']();

    date['set' + utc + 'FullYear'](date['get' + utc + 'FullYear'](), 0, value * 7);

    var n = currentDay - date['get' + utc + 'Day']();

    date['set' + utc + 'Date'](date['get' + utc + 'Date']() + n);

    return new Date(date['set' + utc + 'Milliseconds'](currentMilliseconds));
  }), defineProperty(_incrementHandlers, MONTH, function (date) {
    var newMonth = value - 1;
    var newYear = date['get' + utc + 'FullYear']();
    var newDate = date['get' + utc + 'Date']();
    var shiftMonth = new Date(date['set' + utc + 'FullYear'](newYear, newMonth + 1, 0));

    if (newDate > shiftMonth['get' + utc + 'Date']()) {
      return shiftMonth;
    } else {
      return new Date(date['set' + utc + 'FullYear'](newYear, newMonth, newDate));
    }
  }), defineProperty(_incrementHandlers, YEAR, function (date) {
    var newYear = value;
    var newMonth = date['get' + utc + 'Month']();
    var newDate = date['get' + utc + 'Date']();
    var shiftMonth = new Date(date['set' + utc + 'FullYear'](newYear, newMonth + 1, 0));

    if (newDate > shiftMonth['get' + utc + 'Date']()) {
      return shiftMonth;
    } else {
      return new Date(date['set' + utc + 'FullYear'](newYear, newMonth, newDate));
    }
  }), _incrementHandlers);

  return incrementHandlers[increment](date);
}
function setLocalOrSetUTC(increment, value, date) {
  var _incrementHandlers;

  var utc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';

  var incrementHandlers = (_incrementHandlers = {}, defineProperty(_incrementHandlers, MILLISECOND, function (date) {
    return new Date(date['set' + utc + 'Milliseconds'](value));
  }), defineProperty(_incrementHandlers, SECOND, function (date) {
    return new Date(date['set' + utc + 'Seconds'](value));
  }), defineProperty(_incrementHandlers, MINUTE, function (date) {
    return new Date(date['set' + utc + 'Minutes'](value));
  }), defineProperty(_incrementHandlers, HOUR, function (date) {
    return new Date(date['set' + utc + 'Hours'](value));
  }), defineProperty(_incrementHandlers, DATE, function (date) {
    return new Date(date['set' + utc + 'Date'](value));
  }), defineProperty(_incrementHandlers, DAY, function (date) {
    return new Date(date['set' + utc + 'Date'](date['get' + utc + 'Date']() - date['get' + utc + 'Day']() + (value - 1)));
  }), defineProperty(_incrementHandlers, WEEK, function (date) {
    var currentDay = date['get' + utc + 'Day']();
    var currentMilliseconds = date['get' + utc + 'Milliseconds']();

    date['set' + utc + 'FullYear'](date['get' + utc + 'FullYear'](), 0, value * 7);

    var n = currentDay - date['get' + utc + 'Day']();

    date['set' + utc + 'Date'](date['get' + utc + 'Date']() + n);

    return new Date(date['set' + utc + 'Milliseconds'](currentMilliseconds));
  }), defineProperty(_incrementHandlers, MONTH, function (date) {
    var newMonth = value - 1;
    var newYear = date['get' + utc + 'FullYear']();
    var newDate = date['get' + utc + 'Date']();
    var shiftMonth = new Date(date['set' + utc + 'FullYear'](newYear, newMonth + 1, 0));

    if (newDate > shiftMonth['get' + utc + 'Date']()) {
      return shiftMonth;
    } else {
      return new Date(date['set' + utc + 'FullYear'](newYear, newMonth, newDate));
    }
  }), defineProperty(_incrementHandlers, YEAR, function (date) {
    var newYear = value;
    var newMonth = date['get' + utc + 'Month']();
    var newDate = date['get' + utc + 'Date']();
    var shiftMonth = new Date(date['set' + utc + 'FullYear'](newYear, newMonth + 1, 0));

    if (newDate > shiftMonth['get' + utc + 'Date']()) {
      return shiftMonth;
    } else {
      return new Date(date['set' + utc + 'FullYear'](newYear, newMonth, newDate));
    }
  }), _incrementHandlers);

  return incrementHandlers[increment](date);
}
Sets the date or time to specified interval
@param     {String}  increment   an increment to set
@param     {String}  value       what to set the increment to
@param     {Date}    date        a date object
@returns   {Object}              a new gregorian object