Skip to content

Commit 228505a

Browse files
committed
docs: add docs for timezone
1 parent 4a1870b commit 228505a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,27 @@ $image = new TrmnlPipeline()
9595
echo "Generated image: $image";
9696
```
9797

98+
### Setting the Browser Timezone (optional)
99+
100+
You can control the timezone used by the headless browser when rendering your HTML by calling `timezone()` on `BrowserStage` with any valid PHP timezone identifier (e.g., `UTC`, `America/New_York`, `Europe/Berlin`).
101+
102+
Notes:
103+
- The timezone is only applied when you explicitly call `timezone()`. If you don’t explicitly set the timezone, the browser will use the system timezone.
104+
- This can be helpful when your HTML or scripts render time/date-dependent content.
105+
106+
Example:
107+
108+
```php
109+
use Bnussbau\TrmnlPipeline\Stages\BrowserStage;
110+
111+
$image = (new \Bnussbau\TrmnlPipeline\TrmnlPipeline())
112+
->pipe((new BrowserStage())
113+
->timezone('America/New_York')
114+
->html('<html><body><script>document.write(new Date().toString())</script></body></html>'))
115+
->pipe(new \Bnussbau\TrmnlPipeline\Stages\ImageStage())
116+
->process();
117+
```
118+
98119
### Browser Rendering on AWS Lambda
99120

100121
You can use different Browsershot implementations (like BrowsershotLambda) by passing an instance to the BrowserStage.

0 commit comments

Comments
 (0)