fix: resolve test failures from timezone conversion and interface rename
- Fix CriteriaSheetGenerator.FormatTimestamp to handle all DateTimeKind values - Update TestWebApplicationFactory to use IAuthenticationService - Add logger parameter to ExcelParserServiceTests - Add SecureStoreManager to solution under /utils/ folder
This commit is contained in:
@@ -176,8 +176,17 @@ public class CriteriaSheetGenerator
|
||||
}
|
||||
|
||||
var options = _options.Value;
|
||||
var timezone = TimeZoneInfo.FindSystemTimeZoneById(options.TimezoneId);
|
||||
var localTime = TimeZoneInfo.ConvertTimeFromUtc(dateTime.Value, timezone);
|
||||
var targetTimezone = TimeZoneInfo.FindSystemTimeZoneById(options.TimezoneId);
|
||||
var dt = dateTime.Value;
|
||||
|
||||
// Convert to target timezone based on the source DateTime's Kind
|
||||
var localTime = dt.Kind switch
|
||||
{
|
||||
DateTimeKind.Utc => TimeZoneInfo.ConvertTimeFromUtc(dt, targetTimezone),
|
||||
DateTimeKind.Local => TimeZoneInfo.ConvertTime(dt, TimeZoneInfo.Local, targetTimezone),
|
||||
// Unspecified - database values are stored in target timezone, no conversion needed
|
||||
_ => dt
|
||||
};
|
||||
|
||||
return $"{localTime:MMM dd, yyyy hh:mm:ss tt} {options.TimezoneAbbreviation}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user