How to set a time zone in Puppeteer for page

Updated on Dmytro Krasun 1 min read
Puppeteer allows blocking any outgoing requests while loading the page. Whether you want to block ads, tracking scripts, or different types of resources, it is relatively easy to do with Puppeteer.

By the way, in our screenshot API, you can take the screenshot of the element by specifying the time zone parameter.

Puppeteer allows changing the time zone on a per-page basis. In automation testing, you can test how the website behaves for different time zones. Or you can use it for scrapping to imitate the user from the expected time zone by the site.

It is reasonably simple to do by using page.emulateTimezone(timezoneId):

const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({});
try {
const page = await browser.newPage();
await page.emulateTimezone('Europe/London');
await page.goto('');
} catch (e) {
} finally {
await browser.close();

The list of available time zones you can find at Chromium source code, these are the most popular ones:

  • America/Santiago
  • Asia/Shanghai
  • Europe/Berlin
  • America/Guayaquil
  • Europe/Madrid
  • Pacific/Majuro
  • Asia/Kuala_Lumpur
  • Pacific/Auckland
  • Europe/Lisbon
  • Europe/Kiev
  • Asia/Tashkent
  • Europe/London

I hope I have helped solve the issue and I wish you a nice day!