Date fields always in US format within Dusk tests

Viewed 132

When running dusk tests, date fields within the test are always in US format but I required them to be in British format. My chrome options look like this:

$options = (new ChromeOptions)->addArguments([
            '--disable-gpu',
            '--headless',
            '--no-sandbox',
            '--ignore-ssl-errors',
            '--whitelisted-ips=""',
            '--window-size=1920,1080',
            '--lang=en_GB',
        ]);

In my dusk test case file I am also setting the locale using:

app()->setLocale('en');

Edit: I have also tried setting the language to 'en-GB'

1 Answers

For those who execute dusk on docker with selenium image, in order to solve this you need to pass the LANGUAGE env to selenium container, like this:

selenium:
 image: selenium/standalone-chrome:3.141.59
 environment:
    - LANGUAGE=en_GB.UTF-8
Related