{"record":{"id":"ed574ce5e523ac2b","repo":"nopSolutions/nopCommerce","slug":"enter-shipped-date","errorCode":null,"errorMessage":"Enter shipped date","messagePattern":"Enter shipped date","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs","lineNumber":2225,"sourceCode":"\n    [HttpPost, ActionName(\"ShipmentDetails\")]\n    [FormValueRequired(\"saveshippeddate\")]\n    [CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> EditShippedDate(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.ShippedDateUtc.HasValue)\n                throw new Exception(\"Enter shipped date\");\n\n            shipment.ShippedDateUtc = model.ShippedDateUtc;\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    [HttpPost, ActionName(\"ShipmentDetails\")]\n    [FormValueRequired(\"setasreadyforpickup\")]\n    [CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> SetAsReadyForPickup(int id)\n    {","sourceCodeStart":2207,"sourceCodeEnd":2243,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs#L2207-L2243","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nif (!model.ShippedDateUtc.HasValue)\n    throw new Exception(\"Enter shipped date\");\nshipment.ShippedDateUtc = model.ShippedDateUtc;\n\n// after — default to now when omitted\nshipment.ShippedDateUtc = model.ShippedDateUtc ?? DateTime.UtcNow;\nawait _shipmentService.UpdateShipmentAsync(shipment);","handlingStrategy":"validation","validationCode":"// Before marking shipped: ensure a date, defaulting to now if omitted\nif (!model.ShippedDateUtc.HasValue)\n    model.ShippedDateUtc = DateTime.UtcNow;\nshipment.ShippedDateUtc = model.ShippedDateUtc;","typeGuard":"bool HasShippedDate(ShipmentModel m) => m.ShippedDateUtc.HasValue;","tryCatchPattern":"// The action's try/catch shows the exception via ErrorNotificationAsync; pre-validate the date client-side.","preventionTips":["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."],"tags":["nopcommerce","admin","order","shipment","validation","date"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}