Skip to content

Commit d8176d7

Browse files
authored
Merge pull request #2097 from TechnologyEnhancedLearning/Develop/Features/TD-988-Super-Admin-Centres-Edit-centre-contract-information-pa_
TD-988: Date field errors handled
2 parents 6354cf1 + 3aec06f commit d8176d7

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
@@ -487,17 +487,8 @@ public IActionResult EditContractInfo(ContractTypeViewModel contractTypeViewMode
487487
{
488488
if ((day != 0 && day != null) | (month != 0 && month != null) | (year != 0 && year != null))
489489
{
490-
var validationResult = OldDateValidator.ValidateDate(day ?? 0, month ?? 0, year ?? 0);
491-
if(day!=null&&month!=null&&year!=null)
492-
{
493-
var today = new DateTime(year ?? 0, month ?? 0, day ?? 0);
494-
if (today == DateTime.Now.Date)
495-
{
496-
validationResult.DateValid = true;
497-
validationResult.ErrorMessage = "";
498-
}
499-
}
500-
if (!validationResult.DateValid)
490+
var validationResult = DateValidator.ValidateDate(day ?? 0, month ?? 0, year ?? 0);
491+
if (validationResult.ErrorMessage != null)
501492
{
502493
if (day == null) day = 0;
503494
if (month == null) month = 0;

0 commit comments

Comments
 (0)