Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
deleted 2 characters in body
Source Link
Andrew
  • 49.8k
  • 15
  • 99
  • 145

How about this?

Date.prototype.withoutTime = function () { var d = new Date(this); d.setHours(0, 0, 0, 0, 0); return dd; } 

It allows you to compare the date part of the date like this without affecting the value of your variable:

var date1 = new Date(2014,1,1); new Date().withoutTime() > date1.withoutTime(); // true 

How about this?

Date.prototype.withoutTime = function () { var d = new Date(this); d.setHours(0, 0, 0, 0, 0); return d } 

It allows you to compare the date part of the date like this without affecting the value of your variable:

var date1 = new Date(2014,1,1); new Date().withoutTime() > date1.withoutTime(); // true 

How about this?

Date.prototype.withoutTime = function () { var d = new Date(this); d.setHours(0, 0, 0, 0); return d; } 

It allows you to compare the date part of the date like this without affecting the value of your variable:

var date1 = new Date(2014,1,1); new Date().withoutTime() > date1.withoutTime(); // true 
Source Link
AdEpt
  • 1.1k
  • 1
  • 7
  • 4

How about this?

Date.prototype.withoutTime = function () { var d = new Date(this); d.setHours(0, 0, 0, 0, 0); return d } 

It allows you to compare the date part of the date like this without affecting the value of your variable:

var date1 = new Date(2014,1,1); new Date().withoutTime() > date1.withoutTime(); // true