nopSolutions/nopCommerce · warning · Exception
Enter delivery date
Error message
Enter delivery date
What it means
Thrown in the OrderController shipment 'delivered' action when model.DeliveryDateUtc is null. The action demands an explicit delivery date before updating the shipment. Base Exception, caught, surfaced via ErrorNotificationAsync, redirect to shipment details.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs:2342
[HttpPost, ActionName("ShipmentDetails")]
[FormValueRequired("savedeliverydate")]
[CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]
public virtual async Task<IActionResult> EditDeliveryDate(ShipmentModel model)
{
//try to get a shipment with the specified id
var shipment = await _shipmentService.GetShipmentByIdAsync(model.Id);
if (shipment == null)
return RedirectToAction("List");
//a vendor should have access only to his products
if (await _workContext.GetCurrentVendorAsync() != null && !await HasAccessToShipmentAsync(shipment))
return RedirectToAction("List");
try
{
if (!model.DeliveryDateUtc.HasValue)
throw new Exception("Enter delivery date");
shipment.DeliveryDateUtc = model.DeliveryDateUtc;
await _shipmentService.UpdateShipmentAsync(shipment);
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
catch (Exception exc)
{
//error
await _notificationService.ErrorNotificationAsync(exc);
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
}
[CheckPermission(StandardPermission.Orders.SHIPMENTS_VIEW)]
public virtual async Task<IActionResult> PdfPackagingSlip(int shipmentId)
{
//try to get a shipment with the specified id
var shipment = await _shipmentService.GetShipmentByIdAsync(shipmentId);View on GitHub (pinned to 64bdf2ff08)
Solutions
- Select a delivery date before submitting the form.
- Ensure DeliveryDateUtc is included and parses correctly in the POST.
- Enforce a client-side required validator on the delivery date.
- If appropriate, default DeliveryDateUtc to DateTime.UtcNow when not provided.
Example fix
// before
if (!model.DeliveryDateUtc.HasValue)
throw new Exception("Enter delivery date");
shipment.DeliveryDateUtc = model.DeliveryDateUtc;
// after — default to now when omitted
shipment.DeliveryDateUtc = model.DeliveryDateUtc ?? DateTime.UtcNow;
await _shipmentService.UpdateShipmentAsync(shipment); Defensive patterns
Strategy: validation
Validate before calling
// Before marking delivered: ensure a date, defaulting to now
if (!model.DeliveryDateUtc.HasValue)
model.DeliveryDateUtc = DateTime.UtcNow;
shipment.DeliveryDateUtc = model.DeliveryDateUtc; Type guard
bool HasDeliveryDate(ShipmentModel m) => m.DeliveryDateUtc.HasValue;
Try / catch
// The action's try/catch shows the exception via ErrorNotificationAsync; require the date client-side.
Prevention
- Mark the delivery-date picker as required.
- Default to DateTime.UtcNow for delivery when appropriate.
- Confirm the posted date format parses under the server culture.
When it happens
Trigger: POST to mark a shipment delivered with DeliveryDateUtc missing or null from the request.
Common situations: Delivery date picker left empty; the field removed in a custom view; integration/API call omitting the date; locale format causing the picker to post empty.
Related errors
- Enter shipped date
- Enter ready for pickup date
- Enter amount to refund
- You cannot delete this email account. At least one account i
- Order cannot be loaded
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/819bcc521e8770b2.
Report an issue: GitHub.