Skip to content

Commit f7002da

Browse files
GregBrimbleMaddy-Cloudflare
authored andcommitted
Dynamic (#22057)
1 parent 87dc8c7 commit f7002da

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/components/WranglerConfig.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if (!code) {
2525
}
2626
2727
code = code.replace(/\u007f/g, "\n");
28+
code = code.replaceAll(/\$today/gi, new Date().toISOString().split("T")[0]);
2829
2930
const language =
3031
html.querySelector("[data-language]")?.attributes["data-language"];

src/content/docs/style-guide/components/wrangler-config.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,20 @@ database_id = "<unique-ID-for-your-database>"
2727
</WranglerConfig>
2828

2929
````
30+
31+
A `$today` value can be used in this component to automatically insert the today's date. This is useful for suggesting that users set the latest compatibility date.
32+
33+
34+
````mdx live
35+
import { WranglerConfig } from "~/components";
36+
37+
<WranglerConfig>
38+
```jsonc
39+
{
40+
"name": "my-worker",
41+
"compatibility_date": "$today"
42+
}
43+
```
44+
</WranglerConfig>
45+
46+
````

0 commit comments

Comments
 (0)