Date.prototype.endOf >= 0.1.4

Purpose

Set the current date to the end of a unit of time

Syntax

Date#endOf ( Stringunit );


Parameters

unit
year, quarter, month, week, day, ...

Return values

Date

Returns itself

Examples

var a = new Date("2015-08-26T15:29:00.000Z");>>> Wed Aug 26 2015 17:29:00 GMT+0200 (CEST)

a.endOf('day');>>> Wed Aug 26 2015 23:59:59 GMT+0200 (CEST)