function resetLocalOrResetUTC(increment, date, utc) {
  var _incrementHandlers;

  var incrementHandlers = (_incrementHandlers = {}, defineProperty(_incrementHandlers, SECOND, function (date) {
    return new Date(date['set' + utc + 'Seconds'](date['get' + utc + 'Seconds'](), 0));
  }), defineProperty(_incrementHandlers, MINUTE, function (date) {
    return new Date(date['set' + utc + 'Minutes'](date['get' + utc + 'Minutes'](), 0, 0));
  }), defineProperty(_incrementHandlers, HOUR, function (date) {
    return new Date(date['set' + utc + 'Hours'](date['get' + utc + 'Hours'](), 0, 0, 0));
  }), defineProperty(_incrementHandlers, DATE, function (date) {
    date['set' + utc + 'Date'](date['get' + utc + 'Date']());
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), defineProperty(_incrementHandlers, WEEK, function (date) {
    date['set' + utc + 'Date'](date['get' + utc + 'Date']() - date['get' + utc + 'Day']());
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), defineProperty(_incrementHandlers, MONTH, function (date) {
    date['set' + utc + 'Month'](date['get' + utc + 'Month'](), 1);
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), defineProperty(_incrementHandlers, YEAR, function (date) {
    date['set' + utc + 'FullYear'](date['get' + utc + 'FullYear'](), 0, 1);
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), _incrementHandlers);

  return incrementHandlers[increment](date);
}
function resetLocalOrResetUTC(increment, date, utc) {
  var _incrementHandlers;

  var incrementHandlers = (_incrementHandlers = {}, defineProperty(_incrementHandlers, SECOND, function (date) {
    return new Date(date['set' + utc + 'Seconds'](date['get' + utc + 'Seconds'](), 0));
  }), defineProperty(_incrementHandlers, MINUTE, function (date) {
    return new Date(date['set' + utc + 'Minutes'](date['get' + utc + 'Minutes'](), 0, 0));
  }), defineProperty(_incrementHandlers, HOUR, function (date) {
    return new Date(date['set' + utc + 'Hours'](date['get' + utc + 'Hours'](), 0, 0, 0));
  }), defineProperty(_incrementHandlers, DATE, function (date) {
    date['set' + utc + 'Date'](date['get' + utc + 'Date']());
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), defineProperty(_incrementHandlers, WEEK, function (date) {
    date['set' + utc + 'Date'](date['get' + utc + 'Date']() - date['get' + utc + 'Day']());
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), defineProperty(_incrementHandlers, MONTH, function (date) {
    date['set' + utc + 'Month'](date['get' + utc + 'Month'](), 1);
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), defineProperty(_incrementHandlers, YEAR, function (date) {
    date['set' + utc + 'FullYear'](date['get' + utc + 'FullYear'](), 0, 1);
    date['set' + utc + 'Hours'](0, 0, 0, 0);

    return new Date(date);
  }), _incrementHandlers);

  return incrementHandlers[increment](date);
}
function resetLocalOrResetUTC ( increment , date , utc ) { var _incrementHandlers ; var incrementHandlers = ( _incrementHandlers = { } , defineProperty ( _incrementHandlers , SECOND , function ( date ) { return new Date ( date [ 'set' + utc + 'Seconds' ] ( date [ 'get' + utc + 'Seconds' ] ( ) , 0 ) ) ; } ) , defineProperty ( _incrementHandlers , MINUTE , function ( date ) { return new Date ( date [ 'set' + utc + 'Minutes' ] ( date [ 'get' + utc + 'Minutes' ] ( ) , 0 , 0 ) ) ; } ) , defineProperty ( _incrementHandlers , HOUR , function ( date ) { return new Date ( date [ 'set' + utc + 'Hours' ] ( date [ 'get' + utc + 'Hours' ] ( ) , 0 , 0 , 0 ) ) ; } ) , defineProperty ( _incrementHandlers , DATE , function ( date ) { date [ 'set' + utc + 'Date' ] ( date [ 'get' + utc + 'Date' ] ( ) ) ; date [ 'set' + utc + 'Hours' ] ( 0 , 0 , 0 , 0 ) ; return new Date ( date ) ; } ) , defineProperty ( _incrementHandlers , WEEK , function ( date ) { date [ 'set' + utc + 'Date' ] ( date [ 'get' + utc + 'Date' ] ( ) - date [ 'get' + utc + 'Day' ] ( ) ) ; date [ 'set' + utc + 'Hours' ] ( 0 , 0 , 0 , 0 ) ; return new Date ( date ) ; } ) , defineProperty ( _incrementHandlers , MONTH , function ( date ) { date [ 'set' + utc + 'Month' ] ( date [ 'get' + utc + 'Month' ] ( ) , 1 ) ; date [ 'set' + utc + 'Hours' ] ( 0 , 0 , 0 , 0 ) ; return new Date ( date ) ; } ) , defineProperty ( _incrementHandlers , YEAR , function ( date ) { date [ 'set' + utc + 'FullYear' ] ( date [ 'get' + utc + 'FullYear' ] ( ) , 0 , 1 ) ; date [ 'set' + utc + 'Hours' ] ( 0 , 0 , 0 , 0 ) ; return new Date ( date ) ; } ) , _incrementHandlers ) ; return incrementHandlers [ increment ] ( date ) ; }
Sets the date or time to the start of the specified increment
@param   {String}    increment   an increment to set the date back to
@param   {Date}      date        a date object
@returns {Date}                  a new date
Sets the date or time to the start of the specified increment