Skip to content

Commit

Permalink
Implemented validator with HasTimeZone method
Browse files Browse the repository at this point in the history
  • Loading branch information
khanrn committed Nov 22, 2023
1 parent 4f7bbfd commit 81c48d2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public EmailNotificationOrderRequestValidator()
.WithMessage("A valid email address must be provided for all recipients.");

RuleFor(order => order.RequestedSendTime)
.Must(sendTime => sendTime >= DateTime.UtcNow.AddMinutes(-5))
.WithMessage("Send time must be in the future. Leave blank to send immediately.");
.Must(sendTime => HasTimeZone(sendTime))
.WithMessage("No time zone specified.")
.Must(sendTime => sendTime >= DateTime.UtcNow.AddMinutes(-5))
.WithMessage("Send time must be in the future. Leave blank to send immediately.");

RuleFor(order => order.Body).NotEmpty();
RuleFor(order => order.Subject).NotEmpty();
Expand Down

0 comments on commit 81c48d2

Please sign in to comment.