Is there any way to get the same value of date time in javascript that c#
DateTime.MaxValue
returns?
Asked
Active
Viewed 3,474 times
1

Frank
- 431
- 1
- 5
- 25

Pawan Nogariya
- 8,330
- 12
- 52
- 105
-
1This can possibly help you: http://stackoverflow.com/questions/11526504/minimum-and-maximum-date – henrikmerlander Apr 29 '16 at 09:28
2 Answers
4
The above edge case as mentioned by James Thorpe can be avoided by using:
public dateTimeMax = new Date(9999, 11, 31, 23, 59, 59, 999);
This is because the month is zero-indexed, and the highest value it can take for milliseconds is 999.

markeh21
- 189
- 12
2
Well, yes. The max date in .NET is 23:59:59.9999999 UTC, December 31, 9999
. So this would be the equivalent Javascript:
var d = new Date(9999, 12, 31, 23, 59, 59, 9999999);
There is no Date.MaxValue
in Javascript, so you have to make it your own.

Patrick Hofman
- 153,850
- 22
- 249
- 325
-
Just replace 12 with 11 var d = new Date(9999, 11, 31, 23, 59, 59, 9999999); – Xaris Fytrakis Sep 09 '22 at 10:57