Skip to content

Commit 3aec06f

Browse files
TD-988: Date field errors handled
1 parent 630eaa0 commit 3aec06f

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

DigitalLearningSolutions.Web/Controllers/SuperAdmin/Centres/CentresController.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -481,17 +481,8 @@ public IActionResult EditContractInfo(ContractTypeViewModel contractTypeViewMode
481481
{
482482
if ((day != 0 && day != null) | (month != 0 && month != null) | (year != 0 && year != null))
483483
{
484-
var validationResult = OldDateValidator.ValidateDate(day ?? 0, month ?? 0, year ?? 0);
485-
if(day!=null&&month!=null&&year!=null)
486-
{
487-
var today = new DateTime(year ?? 0, month ?? 0, day ?? 0);
488-
if (today == DateTime.Now.Date)
489-
{
490-
validationResult.DateValid = true;
491-
validationResult.ErrorMessage = "";
492-
}
493-
}
494-
if (!validationResult.DateValid)
484+
var validationResult = DateValidator.ValidateDate(day ?? 0, month ?? 0, year ?? 0);
485+
if (validationResult.ErrorMessage != null)
495486
{
496487
if (day == null) day = 0;
497488
if (month == null) month = 0;

0 commit comments

Comments
 (0)