Skip to content

Commit 0ea6387

Browse files
committed
Add support for Temporal objects
1 parent e6284c9 commit 0ea6387

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

.changeset/eight-ties-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sumup/intl': major
3+
---
4+
5+
Added support for Temporal objects to the date and time formatting functions. The [`temporal-polyfill`](https://www.npmjs.com/package/temporal-polyfill) package is now a required peer dependency.

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,14 @@
5353
"jest": "^29.7.0",
5454
"jest-extended": "^4.0.2",
5555
"license-checker": "^25.0.1",
56+
"temporal-polyfill": "^0.2.5",
5657
"ts-jest": "^29.1.4",
5758
"typedoc": "^0.25.13",
5859
"typedoc-github-wiki-theme": "^2.0.0",
5960
"typedoc-plugin-markdown": "^4.0.3",
6061
"typescript": "^5.4.5"
62+
},
63+
"peerDependencies": {
64+
"temporal-polyfill": "0.2.x"
6165
}
6266
}

src/lib/date-time-format/intl.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* limitations under the License.
1414
*/
1515

16+
import { Intl as IntlWithTemporal } from 'temporal-polyfill';
1617
import memoizeFormatConstructor from 'intl-format-cache';
1718

1819
import { Locale } from '../../types';
@@ -61,8 +62,8 @@ export const isDateTimeStyleSupported = (() => {
6162
})();
6263

6364
export const getDateTimeFormat = memoizeFormatConstructor(
64-
Intl.DateTimeFormat,
65+
IntlWithTemporal.DateTimeFormat,
6566
) as (
6667
locales?: Locale | Locale[],
6768
options?: Intl.DateTimeFormatOptions,
68-
) => Intl.DateTimeFormat;
69+
) => IntlWithTemporal.DateTimeFormat;

0 commit comments

Comments
 (0)