From the spec, §15.9.1.1:

A Date object contains a Number indicating a particular instant in time to within a millisecond. Such a Number is called a time value. A time value may also be NaN, indicating that the Date object does not represent a specific instant of time.

Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC. In time values leap seconds are ignored. It is assumed that there are exactly 86,400,000 milliseconds per day. ECMAScript Number values can represent all integers from –9,007,199,254,740,992 to 9,007,199,254,740,992; this range suffices to measure times to millisecond precision for any instant that is within approximately 285,616 years, either forward or backward, from 01 January, 1970 UTC.

The actual range of times supported by ECMAScript Date objects is slightly smaller: exactly –100,000,000 days to 100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. This gives a range of 8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC.

The exact moment of midnight at the beginning of 01 January, 1970 UTC is represented by the value +0.

The third paragraph being the most relevant. Based on that paragraph, we can get the precise earliest date per spec from new Date(-8640000000000000), which is Tuesday, April 20th, 271,821 BCE (BCE = Before Common Era, e.g., the year -271,821).

Answer from T.J. Crowder on Stack Overflow
Top answer
1 of 5
235

From the spec, §15.9.1.1:

A Date object contains a Number indicating a particular instant in time to within a millisecond. Such a Number is called a time value. A time value may also be NaN, indicating that the Date object does not represent a specific instant of time.

Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC. In time values leap seconds are ignored. It is assumed that there are exactly 86,400,000 milliseconds per day. ECMAScript Number values can represent all integers from –9,007,199,254,740,992 to 9,007,199,254,740,992; this range suffices to measure times to millisecond precision for any instant that is within approximately 285,616 years, either forward or backward, from 01 January, 1970 UTC.

The actual range of times supported by ECMAScript Date objects is slightly smaller: exactly –100,000,000 days to 100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. This gives a range of 8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC.

The exact moment of midnight at the beginning of 01 January, 1970 UTC is represented by the value +0.

The third paragraph being the most relevant. Based on that paragraph, we can get the precise earliest date per spec from new Date(-8640000000000000), which is Tuesday, April 20th, 271,821 BCE (BCE = Before Common Era, e.g., the year -271,821).

2 of 5
98

To augment T.J.'s answer, exceeding the min/max values generates an Invalid Date.

let maxDate = new Date(8640000000000000);
let minDate = new Date(-8640000000000000);

console.log(new Date(maxDate.getTime()).toString());
console.log(new Date(maxDate.getTime() - 1).toString());
console.log(new Date(maxDate.getTime() + 1).toString()); // Invalid Date

console.log(new Date(minDate.getTime()).toString());
console.log(new Date(minDate.getTime() + 1).toString());
console.log(new Date(minDate.getTime() - 1).toString()); // Invalid Date

🌐
30 Seconds of Code
30secondsofcode.org › home › javascript › date › min or max date
Find the minimum or maximum date using JavaScript - 30 seconds of code
January 6, 2024 - const minDate = (...dates) => new Date(Math.min(...dates)); const maxDate = (...dates) => new Date(Math.max(...dates)); const dates = [ new Date('2017-05-13'), new Date('2018-03-12'), new Date('2016-01-10'), new Date('2016-01-09') ]; ...
Discussions

javascript - How to get the minimum and maximum date - Stack Overflow
That defines properties on Date that cannot be changed that have the min/max numeric value for dates. (On a JavaScript engine that has ES5 support.) More on stackoverflow.com
🌐 stackoverflow.com
How to get minimum date from array of object
activities.filter(el => el.date) This would give you only the objects that don't have 'null' for the date property. More on reddit.com
🌐 r/learnjavascript
5
1
October 25, 2021
Getting JavaScript equivalent of DateTime.MinValue - Stack Overflow
In C#, a date can have a min value which is 1/1/0001 12:00:00 AM. This is nice in validation situations. I tried producing this value in JavaScript but it's not working: var minDate = new Date("1/1/ More on stackoverflow.com
🌐 stackoverflow.com
How can I set the min and max attributes of a date input within a (dynamic) range?
How can I set the min and max attributes of a date input within a (dynamic) range · I’ve got the Open Date input to have a default value and min set to today’s date…works perfectly. However, I am struggling with the Close Date input · I’d like the min attribute for the Close Date ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
0
October 12, 2018
🌐
W3Schools
w3schools.com › Jsref › prop_date_min.asp
HTML DOM Input Date min Property
The min attribute specifies the minimum value (date) for a date field.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript - MDN Web Docs - Mozilla
The following examples show how to determine the elapsed time between two JavaScript dates in milliseconds. Due to the differing lengths of days (due to daylight saving changeover), months, and years, expressing elapsed time in units greater than hours, minutes, and seconds requires addressing ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-select-min-max-dates-in-an-array-using-javascript
How to Select Min/Max Dates in an Array Using JavaScript? - GeeksforGeeks
July 12, 2025 - The code uses reduce() to iterate through the dates array, comparing two dates (a and b) at a time. It finds: Minimum date (minDate): By keeping the smaller of a and b.
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-date-exercise-12.php
JavaScript: Minimum date from an array of dates - w3resource
July 17, 2025 - The code defines a JavaScript function named "min_date()" with one parameter 'all_dates', representing an array of date strings.
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-max-min-date-in-array-of-objects
Get the Max/Min Date in an Array of Objects in JavaScript | bobbyhadz
Pass the result to the Date() constructor. The Math.min and Math.max functions will return the timestamp of the Min/Max date.
Find elsewhere
🌐
Plain English
plainenglish.io › home › blog › javascript › how to get the min and max dates in a javascript date array?
How to Get the Min and Max Dates in a JavaScript Date Array?
March 23, 2023 - Then we pass in the returned timestamp into the Date constructor to recreate them as dates. ... We can use the Math.max and Math.min methods to get the max and min dates respectively.
🌐
Mobiscroll
demo.mobiscroll.com › javascript › datetime › min-max-restrictions
Javascript Date & Time Min & max values Example | Mobiscroll
May 31, 2024 - Javascript date time picker & scroller with min/max restrictions, DOB picker, custom header text for instructions. Plain JS api for usage everywhere.
🌐
W3Schools
w3schools.com › jsref › prop_datetime_min.asp
HTML DOM Input Datetime min Property
The min attribute specifies the minimum value (date and time) for a datetime field.
🌐
Mobiscroll
demo.mobiscroll.com › jquery › datetime › min-max-restrictions
JQuery Date & Time Min & max values Example | Mobiscroll
JQuery date time picker & scroller with min/max restrictions, DOB picker, custom header text for instructions. For jQuery or jQuery Mobile.
🌐
Reddit
reddit.com › r/learnjavascript › how to get minimum date from array of object
r/learnjavascript on Reddit: How to get minimum date from array of object
October 25, 2021 -

Hello,

I would like to get the minimum date of this array of objects bellow:

let activities = [
  { title: 'Hiking', date: '2019-06-13' },
  { title: 'Shopping', date: '2019-06-10' },
  { title: 'Trekking', date: '2019-06-22' },
  { title: 'Trekking', date: null }
]

let sortedActivities = activities.sort((a, b) => new Date(a.date) - new Date(b.date))
console.log(sortedActivities[0])

The problem is when date activities.date is null it always returns null .

What's the best way to reject null value from this comparison ?

Thanks

🌐
Day.js
day.js.org › docs › en › get-set › min
Minimum · Day.js
dayjs.extend(minMax) dayjs.min(dayjs(), dayjs('2018-01-01'), dayjs('2019-01-01')) dayjs.min([dayjs(), dayjs('2018-01-01'), dayjs('2019-01-01')])
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
How can I set the min and max attributes of a date input within a (dynamic) range? - JavaScript - The freeCodeCamp Forum
October 12, 2018 - Hello :slight_smile: I have some code like this: //HTML: <!-- value & min should be today --> <input type="date" id="listingDateOpen"> <!-- min should be Open Date's value, value & max should be 1 month from that date-…
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getMinutes
Date.prototype.getMinutes() - JavaScript - MDN Web Docs
July 10, 2025 - const birthday = new Date("March 13, 08 04:20"); console.log(birthday.getMinutes()); // Expected output: 20 ... An integer, between 0 and 59, representing the minutes for the given date according to local time.
🌐
Tutorial Reference
tutorialreference.com › javascript › examples › faq › javascript-how-to-get-max-min-date-in-an-array
How to Get the Max or Min Date in an Array in JavaScript | Tutorial Reference
The key to finding the max or min date is to understand that when JavaScript's Math.max() or Math.min() functions receive a Date object, they implicitly convert it to its numeric representation: the timestamp (the number of milliseconds since the Unix Epoch).