Skip to content
Advertisement

Get Min date and Max date from Object

How can I find out the min and the max date from an object? Currently, I am getting an array like this: min date should be ‘2010-02-24’ and max date should be ‘2022-10-04’.

Is there any built-in function to do this? Thanks in advance.

JavaScript

Advertisement

Answer

A sort will do the job here, by packing all dates into an array first:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement