Created
May 2, 2022 05:11
-
-
Save codykonior/79d349c81e7a2ff4ca75160a45620535 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let GetPatchTuesday = (timestamp: datetime) { | |
case( | |
dayofweek(startofmonth(timestamp) + 07d) == 2d, startofmonth(timestamp) + 07d, | |
dayofweek(startofmonth(timestamp) + 08d) == 2d, startofmonth(timestamp) + 08d, | |
dayofweek(startofmonth(timestamp) + 09d) == 2d, startofmonth(timestamp) + 09d, | |
dayofweek(startofmonth(timestamp) + 10d) == 2d, startofmonth(timestamp) + 10d, | |
dayofweek(startofmonth(timestamp) + 11d) == 2d, startofmonth(timestamp) + 11d, | |
dayofweek(startofmonth(timestamp) + 12d) == 2d, startofmonth(timestamp) + 12d, | |
startofmonth(timestamp) + 13d | |
) | |
}; | |
let patchTuesday = case(GetPatchTuesday(now()) <= now(), GetPatchTuesday(now()), GetPatchTuesday(now() - 14d)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment