Skip to content

Commit 265a9db

Browse files
authored
Merge pull request #208 from github/use-intl-without-window-prefix
use `Intl` without window prefix
2 parents 82f9512 + 6a60b84 commit 265a9db

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/relative-time-element.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import {RelativeTimeFormat as RelativeTimeFormatPonyfill} from './relative-time-
44
import {isDuration, withinDuration} from './duration.js'
55
import {strftime} from './strftime.js'
66

7-
const supportsIntlDatetime = 'Intl' in window && 'DateTimeFormat' in Intl
7+
const supportsIntlDatetime = typeof Intl !== 'undefined' && 'DateTimeFormat' in Intl
88
const DateTimeFormat = supportsIntlDatetime ? Intl.DateTimeFormat : DateTimeFormatPonyFill
99

10-
const supportsIntlRelativeTime = 'Intl' in window && 'RelativeTimeFormat' in Intl
10+
const supportsIntlRelativeTime = typeof Intl !== 'undefined' && 'RelativeTimeFormat' in Intl
1111
const RelativeTimeFormat = supportsIntlRelativeTime ? Intl.RelativeTimeFormat : RelativeTimeFormatPonyfill
1212

1313
export type Format = 'auto' | 'micro' | 'elapsed' | string

src/strftime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const supportsIntlDatetime = 'Intl' in window && 'DateTimeFormat' in Intl
1+
const supportsIntlDatetime = typeof Intl !== 'undefined' && 'DateTimeFormat' in Intl
22

33
const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
44
const months = [

0 commit comments

Comments
 (0)