Skip to content

Commit 83c6d36

Browse files
committed
fix: improve date format error message in ViewAppointmentByDateParser
1 parent 860be4d commit 83c6d36

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/seedu/address/logic/parser/ViewAppointmentByDateParser.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
public class ViewAppointmentByDateParser implements Parser<ViewAppointmentByDateCommand> {
1717

18+
private static final String MESSAGE_INVALID_DATE_FORMAT =
19+
"Please enter a valid date. The correct format is dd-MM-yyyy";
20+
1821
@Override
1922
public ViewAppointmentByDateCommand parse(String args) throws ParseException {
2023
ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_DATE);
@@ -29,7 +32,7 @@ public ViewAppointmentByDateCommand parse(String args) throws ParseException {
2932
try {
3033
date = LocalDate.parse(argMultimap.getValue(PREFIX_DATE).get(), DateUtil.getDateFormatter());
3134
} catch (Exception e) {
32-
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
35+
throw new ParseException(String.format(MESSAGE_INVALID_DATE_FORMAT,
3336
ViewAppointmentByDateCommand.MESSAGE_USAGE));
3437
}
3538

0 commit comments

Comments
 (0)