nopSolutions/nopCommerce · warning · Exception
Enter shipped date
Error message
Enter shipped date
What it means
Thrown in the OrderController shipment 'set as shipped' action when model.ShippedDateUtc has no value (null DateTime?). The action requires an explicit shipped date before updating the shipment record. Uses the base Exception type (not NopException); caught and surfaced via ErrorNotificationAsync, then redirects back to shipment details.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs:2225
[HttpPost, ActionName("ShipmentDetails")]
[FormValueRequired("saveshippeddate")]
[CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]
public virtual async Task<IActionResult> EditShippedDate(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.ShippedDateUtc.HasValue)
throw new Exception("Enter shipped date");
shipment.ShippedDateUtc = model.ShippedDateUtc;
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 });
}
}
[HttpPost, ActionName("ShipmentDetails")]
[FormValueRequired("setasreadyforpickup")]
[CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]
public virtual async Task<IActionResult> SetAsReadyForPickup(int id)
{View on GitHub (pinned to 64bdf2ff08)
Solutions
- Select a shipped date in the date picker before submitting.
- Ensure the ShippedDateUtc field is included in the POST payload and parses server-side.
- Add a client-side 'required' validator on the shipped date input.
- If the date should default to now, populate ShippedDateUtc = DateTime.UtcNow when the field is empty rather than throwing.
Example fix
// before
if (!model.ShippedDateUtc.HasValue)
throw new Exception("Enter shipped date");
shipment.ShippedDateUtc = model.ShippedDateUtc;
// after — default to now when omitted
shipment.ShippedDateUtc = model.ShippedDateUtc ?? DateTime.UtcNow;
await _shipmentService.UpdateShipmentAsync(shipment); Defensive patterns
Strategy: validation
Validate before calling
// Before marking shipped: ensure a date, defaulting to now if omitted
if (!model.ShippedDateUtc.HasValue)
model.ShippedDateUtc = DateTime.UtcNow;
shipment.ShippedDateUtc = model.ShippedDateUtc; Type guard
bool HasShippedDate(ShipmentModel m) => m.ShippedDateUtc.HasValue;
Try / catch
// The action's try/catch shows the exception via ErrorNotificationAsync; pre-validate the date client-side.
Prevention
- Mark the shipped-date picker as required client-side.
- Default the date to DateTime.UtcNow in the form when creating a shipment.
- Ensure the posted date format parses under the server culture.
When it happens
Trigger: POST to mark a shipment as shipped with ShippedDateUtc omitted or null — e.g. the date picker was left empty or the field was not posted.
Common situations: A form customization that removed or hid the shipped-date picker; client-side required validation disabled; an API/integration call to the endpoint that omitted the date field; browser date-picker returning empty due to format mismatch.
Related errors
- Enter ready for pickup date
- Enter delivery 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/ed574ce5e523ac2b.
Report an issue: GitHub.