diff --git a/.github/workflows/daily-release.yml b/.github/workflows/daily-release.yml index e98f284306a..52ecff0ae62 100644 --- a/.github/workflows/daily-release.yml +++ b/.github/workflows/daily-release.yml @@ -22,7 +22,7 @@ jobs: - name: Get current date id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + run: echo "date=$(date -d '+7 days' +'%Y-%m-%d')" >> $GITHUB_OUTPUT - name: Update compatibility date run: | diff --git a/src/workerd/io/compatibility-date.c++ b/src/workerd/io/compatibility-date.c++ index be2ec8b4f42..7c18ef29d6e 100644 --- a/src/workerd/io/compatibility-date.c++ +++ b/src/workerd/io/compatibility-date.c++ @@ -115,12 +115,22 @@ static void compileCompatibilityFlags(kj::StringPtr compatDate, "date supported by this server binary is \"", SUPPORTED_COMPATIBILITY_DATE, "\".")); } + + // workerd is built with SUPPORTED_COMPATIBILITY_DATE set a little bit into the futurue, so + // that the build can support setting the compat date to today until the next release is + // ready. But we don't want people to actually set their compat date in the future, so let's + // check against the clock time as well. + if (CompatDate::today() < parsedCompatDate) { + errorReporter.addError(kj::str("Can't set compatibility date in the future: \"", + parsedCompatDate, "\". Today's date (UTC) is \"", CompatDate::today(), "\".")); + } + break; case CompatibilityDateValidation::CURRENT_DATE_FOR_CLOUDFLARE: if (CompatDate::today() < parsedCompatDate) { - errorReporter.addError( - kj::str("Can't set compatibility date in the future: ", parsedCompatDate)); + errorReporter.addError(kj::str("Can't set compatibility date in the future: \"", + parsedCompatDate, "\". Today's date (UTC) is \"", CompatDate::today(), "\".")); } break;