- Move admin credentials from hardcoded values to configuration - Add rate limiting (5/min) to login endpoint for brute force protection - Extract CleanJsonResponse to shared JsonResponseHelper class - Add DateHelpers.MonthsBetween utility and consolidate date calculations - Update PdfReportService to use ScoreThresholds constants - Remove 5 unused shared components (EmploymentTable, FlagsList, etc.) - Clean up unused CSS from MainLayout.razor.css - Create IPdfReportService interface for better testability - Add authentication requirement to Hangfire dashboard in development - Seal EducationVerifierService class Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
866 B
C#
36 lines
866 B
C#
namespace TrueCV.Application.Helpers;
|
|
|
|
public static class DateHelpers
|
|
{
|
|
/// <summary>
|
|
/// Calculates the number of months between two dates.
|
|
/// </summary>
|
|
public static int MonthsBetween(DateOnly start, DateOnly end)
|
|
{
|
|
return ((end.Year - start.Year) * 12) + (end.Month - start.Month);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Calculates the number of months between two dates.
|
|
/// </summary>
|
|
public static int MonthsBetween(DateTime start, DateTime end)
|
|
{
|
|
return ((end.Year - start.Year) * 12) + (end.Month - start.Month);
|
|
}
|
|
|
|
public static DateOnly? ParseDate(string? dateString)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(dateString))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
if (DateOnly.TryParse(dateString, out var date))
|
|
{
|
|
return date;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|