Skip to content

Commit d9b9c03

Browse files
allow significant date to be entered in past (#745)
Co-authored-by: Thomas McInnes <128510230+thomasmcinnes-nimble@users.noreply.github.com>
1 parent 843714d commit d9b9c03

6 files changed

Lines changed: 10 additions & 57 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Security in case of vulnerabilities.
1616

1717
## Unreleased
1818

19+
### Changed
20+
- [282791](https://dfe-gov-uk.visualstudio.com/Academies-and-Free-Schools-SIP/_workitems/edit/282791) - Removed future date requirement on significant date
21+
1922
See the [full commit history](https://github.com/DFE-Digital/complete-conversions-transfers-changes/compare/production-2026-05-13.1533...main) for everything awaiting release
2023

2124
---

src/Core/Dfe.Complete.Application/Validation/SignificantDateValidator.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ public class SignificantDateValidator : ISignificantDateValidator
1313
{
1414
public ValidationResult ValidateSignificantDate(DateOnly? significantDate, ProjectDto? existingProject = null, DateOnly? payrollDeadline = null)
1515
{
16-
// Basic future date validation
17-
var futureValidation = ValidateSignificantDateInFuture(significantDate);
18-
if (!futureValidation.IsValid)
19-
return futureValidation;
20-
2116
// If we have an existing project, check it's not the same as current date
2217
if (existingProject != null)
2318
{

src/Tests/Dfe.Complete.Application.Tests/Validators/SignificantDateValidatorTests.cs

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void ValidateSignificantDate_WithValidFutureDate_AndNoExistingProject_Ret
3535
}
3636

3737
[Fact]
38-
public void ValidateSignificantDate_WithPastDate_ReturnsError()
38+
public void ValidateSignificantDate_WithPastDate_ReturnsSuccess()
3939
{
4040
// Arrange
4141
var pastDate = DateOnly.FromDateTime(DateTime.Today.AddDays(-1));
@@ -44,8 +44,7 @@ public void ValidateSignificantDate_WithPastDate_ReturnsError()
4444
var result = _validator.ValidateSignificantDate(pastDate);
4545

4646
// Assert
47-
Assert.False(result.IsValid);
48-
Assert.Equal("The Significant date must be in the future.", result.ErrorMessage);
47+
Assert.True(result.IsValid);
4948
}
5049

5150
[Fact]
@@ -78,22 +77,6 @@ public void ValidateSignificantDate_WithSameDateAsExisting_ReturnsError()
7877
Assert.Equal("The new date cannot be the same as the current date. Check you have entered the correct date.", result.ErrorMessage);
7978
}
8079

81-
[Fact]
82-
public void ValidateSignificantDate_WithPastDate_ReturnsErrorRegardlessOfExistingProject()
83-
{
84-
// Arrange
85-
var pastDate = DateOnly.FromDateTime(DateTime.Today.AddDays(-1));
86-
var currentDate = DateOnly.FromDateTime(DateTime.Today.AddDays(5));
87-
var existingProject = CreateTestProject(currentDate);
88-
89-
// Act
90-
var result = _validator.ValidateSignificantDate(pastDate, existingProject);
91-
92-
// Assert
93-
Assert.False(result.IsValid);
94-
Assert.Equal("The Significant date must be in the future.", result.ErrorMessage);
95-
}
96-
9780
[Fact]
9881
public void ValidateSignificantDate_WithNullDate_ReturnsSuccess()
9982
{
@@ -130,7 +113,7 @@ public void ValidateSignificantDate_WithVariousFutureDates_ReturnsSuccess(int da
130113
[InlineData(-1)] // Yesterday
131114
[InlineData(-30)] // Last month
132115
[InlineData(-365)] // Last year
133-
public void ValidateSignificantDate_WithVariousPastDates_ReturnsError(int daysInPast)
116+
public void ValidateSignificantDate_WithVariousPastDates_ReturnsSuccess(int daysInPast)
134117
{
135118
// Arrange
136119
var pastDate = DateOnly.FromDateTime(DateTime.Today.AddDays(daysInPast));
@@ -139,8 +122,7 @@ public void ValidateSignificantDate_WithVariousPastDates_ReturnsError(int daysIn
139122
var result = _validator.ValidateSignificantDate(pastDate);
140123

141124
// Assert
142-
Assert.False(result.IsValid);
143-
Assert.Equal("The Significant date must be in the future.", result.ErrorMessage);
125+
Assert.True(result.IsValid);
144126
}
145127

146128
#endregion
@@ -164,19 +146,18 @@ public void ValidateSignificantDate_WithPayrollDeadline_ValidFutureDate_AndAfter
164146
}
165147

166148
[Fact]
167-
public void ValidateSignificantDate_WithPayrollDeadline_SignificantDateInPast_ReturnsError()
149+
public void ValidateSignificantDate_WithPayrollDeadline_SignificantDateInPast_ReturnsSuccess()
168150
{
169151
// Arrange
170-
var payrollDate = DateOnly.FromDateTime(DateTime.Today.AddDays(5));
152+
var payrollDate = DateOnly.FromDateTime(DateTime.Today.AddDays(-5));
171153
var significantDate = DateOnly.FromDateTime(DateTime.Today.AddDays(-1));
172154
var existingProject = CreateTestProject(DateOnly.FromDateTime(DateTime.Today.AddDays(15)));
173155

174156
// Act
175157
var result = _validator.ValidateSignificantDate(significantDate, existingProject, payrollDate);
176158

177159
// Assert
178-
Assert.False(result.IsValid);
179-
Assert.Equal("The Significant date must be in the future.", result.ErrorMessage);
160+
Assert.True(result.IsValid);
180161
}
181162

182163
[Fact]

src/Tests/Dfe.Complete.CypressTests/cypress/e2e/conversion-tasks/group-two/external-stakeholder-kick-off.cy.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
} from "cypress/support/formatDate";
1717
import stakeholderKickOffTaskPage from "cypress/pages/projects/tasks/stakeholderKickOffTaskPage";
1818
import projectDetailsPage from "cypress/pages/projects/projectDetails/projectDetailsPage";
19-
import validationComponent from "cypress/pages/validationComponent";
2019
import { ConversionTasksGroupTwoSetup } from "cypress/support/conversionTasksSetup";
2120
import { urnPool } from "cypress/constants/testUrns";
2221

@@ -109,12 +108,6 @@ describe("Conversion tasks - External stakeholder kick off", () => {
109108
taskListPage.hasTaskStatusCompleted("External stakeholder kick-off");
110109
});
111110

112-
it("Should NOT be able to set a conversion date in the past", () => {
113-
cy.visit(`projects/${project2Id}/tasks/${taskPath}`);
114-
stakeholderKickOffTaskPage.enterSignificantDate(1, 2020).saveAndReturn();
115-
validationComponent.hasLinkedValidationError("The Significant date must be in the future");
116-
});
117-
118111
it("Should only be able to confirm the conversion date once", () => {
119112
cy.visit(`projects/${project2Id}/tasks`);
120113
projectDetailsPage.hasProvisionalDateTag();

src/Tests/Dfe.Complete.CypressTests/cypress/e2e/conversions/change-conversion-date.cy.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,6 @@ describe("Change the conversion date tests", () => {
187187
projectDetailsPage.doesntContain("Change conversion date");
188188
});
189189

190-
it("Should display error when trying to change conversion date to a past date", () => {
191-
cy.visit(`projects/${confirmedDateProjectId}/date-history`);
192-
193-
Logger.log("Click 'Change conversion date' button");
194-
projectDetailsPage.clickButton("Change conversion date");
195-
196-
Logger.log("Enter past date");
197-
changeDatePage.enterDate(1, 2025).saveAndContinue();
198-
199-
validationComponent.hasLinkedValidationError("The Significant date must be in the future");
200-
});
201-
202190
it("Should NOT be able to submit a change conversion date request with no reasons selected", () => {
203191
cy.visit(`projects/${confirmedDateProjectId}/tasks`);
204192

src/Tests/Dfe.Complete.CypressTests/cypress/e2e/transfer-tasks/group-two/external-stakeholder-kick-off.cy.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
} from "cypress/support/formatDate";
1515
import stakeholderKickOffTaskPage from "cypress/pages/projects/tasks/stakeholderKickOffTaskPage";
1616
import projectDetailsPage from "cypress/pages/projects/projectDetails/projectDetailsPage";
17-
import validationComponent from "cypress/pages/validationComponent";
1817
import { urnPool } from "cypress/constants/testUrns";
1918
import { rdoLondonUser } from "cypress/constants/cypressConstants";
2019

@@ -107,12 +106,6 @@ describe("Transfers tasks - External stakeholder kick-off", () => {
107106
.isUnticked();
108107
});
109108

110-
it("Should NOT be able to set a transfer date in the past", () => {
111-
cy.visit(`projects/${project2Id}/tasks/stakeholder_kick_off`);
112-
stakeholderKickOffTaskPage.enterSignificantDate(1, 2020).saveAndReturn();
113-
validationComponent.hasLinkedValidationError("The Significant date must be in the future");
114-
});
115-
116109
it("Should only be able to confirm the transfer date once", () => {
117110
cy.visit(`projects/${project2Id}/tasks`);
118111
projectDetailsPage.hasProvisionalDateTag();

0 commit comments

Comments
 (0)