| function shouldBe(actual, expected) { |
| throw new Error('bad value: ' + actual); |
| let o = new Intl.DateTimeFormat("en" , { |
| shouldBe(o.format(now), `2:31 PM`); |
| shouldBe(JSON.stringify(o.resolvedOptions()), `{"locale":"en","calendar":"gregory","numberingSystem":"latn","timeZone":"UTC","hourCycle":"h12","hour12":true,"timeStyle":"short"}`); |
| let o = new Intl.DateTimeFormat("en" , { |
| shouldBe(o.format(now), `6/22/20`); |
| shouldBe(JSON.stringify(o.resolvedOptions()), `{"locale":"en","calendar":"gregory","numberingSystem":"latn","timeZone":"UTC","dateStyle":"short"}`); |
| let o = new Intl.DateTimeFormat("en" , { |
| shouldBe(o.format(now), `6/22/20, 2:31:52 PM`); |
| shouldBe(JSON.stringify(o.resolvedOptions()), `{"locale":"en","calendar":"gregory","numberingSystem":"latn","timeZone":"UTC","hourCycle":"h12","hour12":true,"dateStyle":"short","timeStyle":"medium"}`); |