{"record":{"id":"819bcc521e8770b2","repo":"nopSolutions/nopCommerce","slug":"enter-delivery-date","errorCode":null,"errorMessage":"Enter delivery date","messagePattern":"Enter delivery date","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs","lineNumber":2342,"sourceCode":"\n    [HttpPost, ActionName(\"ShipmentDetails\")]\n    [FormValueRequired(\"savedeliverydate\")]\n    [CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> EditDeliveryDate(ShipmentModel model)\n    {\n        //try to get a shipment with the specified id\n        var shipment = await _shipmentService.GetShipmentByIdAsync(model.Id);\n        if (shipment == null)\n            return RedirectToAction(\"List\");\n\n        //a vendor should have access only to his products\n        if (await _workContext.GetCurrentVendorAsync() != null && !await HasAccessToShipmentAsync(shipment))\n            return RedirectToAction(\"List\");\n\n        try\n        {\n            if (!model.DeliveryDateUtc.HasValue)\n                throw new Exception(\"Enter delivery date\");\n\n            shipment.DeliveryDateUtc = model.DeliveryDateUtc;\n            await _shipmentService.UpdateShipmentAsync(shipment);\n            return RedirectToAction(\"ShipmentDetails\", new { id = shipment.Id });\n        }\n        catch (Exception exc)\n        {\n            //error\n            await _notificationService.ErrorNotificationAsync(exc);\n            return RedirectToAction(\"ShipmentDetails\", new { id = shipment.Id });\n        }\n    }\n\n    [CheckPermission(StandardPermission.Orders.SHIPMENTS_VIEW)]\n    public virtual async Task<IActionResult> PdfPackagingSlip(int shipmentId)\n    {\n        //try to get a shipment with the specified id\n        var shipment = await _shipmentService.GetShipmentByIdAsync(shipmentId);","sourceCodeStart":2324,"sourceCodeEnd":2360,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs#L2324-L2360","documentation":"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.","triggerScenarios":"POST to mark a shipment delivered with DeliveryDateUtc missing or null from the request.","commonSituations":"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.","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."],"exampleFix":"// before\nif (!model.DeliveryDateUtc.HasValue)\n    throw new Exception(\"Enter delivery date\");\nshipment.DeliveryDateUtc = model.DeliveryDateUtc;\n\n// after — default to now when omitted\nshipment.DeliveryDateUtc = model.DeliveryDateUtc ?? DateTime.UtcNow;\nawait _shipmentService.UpdateShipmentAsync(shipment);","handlingStrategy":"validation","validationCode":"// Before marking delivered: ensure a date, defaulting to now\nif (!model.DeliveryDateUtc.HasValue)\n    model.DeliveryDateUtc = DateTime.UtcNow;\nshipment.DeliveryDateUtc = model.DeliveryDateUtc;","typeGuard":"bool HasDeliveryDate(ShipmentModel m) => m.DeliveryDateUtc.HasValue;","tryCatchPattern":"// The action's try/catch shows the exception via ErrorNotificationAsync; require the date client-side.","preventionTips":["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."],"tags":["nopcommerce","admin","order","shipment","validation","date","delivery"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}