Skip to content

Conversation

mpritchard2
Copy link
Contributor

🛠️ Description

This fixes an issue in the validation of the provided time in Reset-AutomationSchedules.ps1. The current implementation was checking UTC - 1 hour against the local time of the parsed time string instead of UTC. The current implementation was also checking if sooner than an hour ago instead of sooner than an hour in the future.

Output of the original script from when I encountered the bug:

Please, enter a new base time for the weekly schedules in UTC (YYYY-MM-dd HH:mm:ss). If you want to keep the current one, just press ENTER: 2025-10-02 06:00:00
Exception: C:\Working\finops-toolkit\src\optimization-engine\Reset-AutomationSchedules.ps1:90
Line |
90 | throw "$newBaseTimeStr is an invalid base time. It can't be s …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 2025-10-02 06:00:00Z is an invalid base time. It can't be sooner than 2025-10-02 02:56:01Z

📋 Checklist

🔬 How did you test this change?

  • 🤏 Lint tests
  • 🤞 PS -WhatIf / az validate
  • 👍 Manually deployed + verified
  • 💪 Unit tests
  • 🙌 Integration tests

🙋‍♀️ Do any of the following that apply?

  • 🚨 This is a breaking change.
  • 🤏 The change is less than 20 lines of code.

📑 Did you update docs/changelog.md?

  • ✅ Updated changelog (required for dev PRs)
  • ➡️ Will add log in a future PR (feature branch PRs only)
  • ❎ Log not needed (small/internal change)

📖 Did you update documentation?

  • ✅ Public docs in docs (required for dev)
  • ✅ Internal dev docs in src (required for dev)
  • ➡️ Will add docs in a future PR (feature branch PRs only)
  • ❎ Docs not needed (small/internal change)

@microsoft-github-policy-service microsoft-github-policy-service bot added Micro PR 🔬 Very small PR that should be especially easy for newcomers Needs: Review 👀 PR that is ready to be reviewed labels Oct 2, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Tool: Optimization Engine Azure Optimization Engine label Oct 2, 2025
@helderpinto
Copy link
Member

Thank you for the contribution, @mpritchard2. Allow me some time to review and test the proposed change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Micro PR 🔬 Very small PR that should be especially easy for newcomers Needs: Review 👀 PR that is ready to be reviewed Tool: Optimization Engine Azure Optimization Engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants