Assuming the team knew that planet Miller would only have a few hours of data, visiting the planet was still a rational decision. They had 3 options, and they thought they would have enough fuel to try at least 2 before returning to earth. Edmunds was sending no signal, so the hope was that Dr. Miller, by not immediately ending her signal when she landed, thought the planet at least had potential.
As to why
Amelia Brand risked her life to obtain the probably worthless data,
that decision was likely a poor one even regardless of the time factor: they were already aware the planet was covered in water and plagued by massive waves.
One of the main themes of the movie is the contrast between humans innovating vs. behaving irrationally when faced with death ("the dying of the light"). This was an example of Amelia behaving irrationally, similar to
Tom keeping his family on the farm even when their lungs were clogging with dust
Dr. Mann opening the hatch to the Endurance even when he hadn't attached properly.
Amelia was probably frazzled by the danger they were in and the massive use of time, and (irrationally) hoped she could make the effort less futile by trying to save the data.
Eventually, the film favors the interpretation that despite our occasional irrationality, humans face death by innovating and helping each other, as evidenced by
Cooper sending Murph messages via the tesseract, her solving the gravity problem, future humans building the wormhole for past humans, etc.