I have a component that sets the startDate and endDate based on various selectors in the dropdown the user may choose.
Code looks like so:
  const handleDateOptionChange = option => {
    if (option?.value === "day") {
      setStartDate(moment().startOf("day"));
      setEndDate(moment());
    }
    if (option?.value === "week") {
      setStartDate(moment().startOf("week"));
      setEndDate(moment());
    }
    if (option?.value === "month") {
      setStartDate(moment().startOf("month"));
      setEndDate(moment());
    }
...
    setDateOption(option);
  };
For my purposes, I'm trying to compare the startDate and endDate's values to moment() objects so that I can find a way to keep the correct selector in the dropdown selected on a page refresh (I'm grabbing start and endDate from queryParams).
I have a piece of code to test this out that looks like so:
 const setDateOption = () => {
    console.log(startDate);
    console.log(moment().startOf("day"));
    if (startDate == moment().startOf("day") && endDate == moment()) {
      return dateOptions[0];
    }
    return dateOptions[1];
  };
Obviously I'm learning I cannot compare them that way. The output of those respective objects are as follows:

The _d portions of the moment object match, but I've been told to not use those for comparisons. How might I compare my startDate with an actual moment() type object?
 
    
 
    