Skip to content

Commit 1d78292

Browse files
Roland Krummenacherclaude
andcommitted
refactor(powershell): drop redundant millisecond subtraction in backfill end date
The -Backfill default end date subtracted a millisecond to land on the last day of the window, then had the time truncated away by .Date a few lines later. For a midnight start date -- always the case here, since both -StartDate sources are midnight -- AddMonths(1).AddMilliseconds(-1).Date and AddMonths(1).AddDays(-1) are identical, so this is a no-op. Using AddDays(-1) also makes the two default-end-date paths read the same; the non-backfill branch below already computes it that way. Note this is not the same as 'the last day of the month': with an explicit -StartDate that is not the first (for example -StartDate '2026-03-15' -Backfill 2), the window stays one month from the start date and ends 2026-04-14, not 2026-03-31. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 3ea191f commit 1d78292

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/powershell/Public/Start-FinOpsCostExport.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function Start-FinOpsCostExport
119119
# If -EndDate is not set, assume 1 month
120120
if (-not $EndDate)
121121
{
122-
$EndDate = $StartDate.AddMonths(1).AddMilliseconds(-1)
122+
$EndDate = $StartDate.AddMonths(1).AddDays(-1)
123123
}
124124

125125
# Move start date to account for the backfill period

0 commit comments

Comments
 (0)