Skip to content

Commit 0b54681

Browse files
Match the JS API for locale arguments (#4806)
1 parent c0ed246 commit 0b54681

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

.changeset/proud-humans-wave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": patch
3+
---
4+
5+
Match the JS API for locale arguments

packages/effect/src/DateTime.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,15 +1445,15 @@ export const format: {
14451445
(
14461446
options?:
14471447
| Intl.DateTimeFormatOptions & {
1448-
readonly locale?: string | undefined
1448+
readonly locale?: Intl.LocalesArgument
14491449
}
14501450
| undefined
14511451
): (self: DateTime) => string
14521452
(
14531453
self: DateTime,
14541454
options?:
14551455
| Intl.DateTimeFormatOptions & {
1456-
readonly locale?: string | undefined
1456+
readonly locale?: Intl.LocalesArgument
14571457
}
14581458
| undefined
14591459
): string
@@ -1471,15 +1471,15 @@ export const formatLocal: {
14711471
(
14721472
options?:
14731473
| Intl.DateTimeFormatOptions & {
1474-
readonly locale?: string | undefined
1474+
readonly locale?: Intl.LocalesArgument
14751475
}
14761476
| undefined
14771477
): (self: DateTime) => string
14781478
(
14791479
self: DateTime,
14801480
options?:
14811481
| Intl.DateTimeFormatOptions & {
1482-
readonly locale?: string | undefined
1482+
readonly locale?: Intl.LocalesArgument
14831483
}
14841484
| undefined
14851485
): string
@@ -1497,15 +1497,15 @@ export const formatUtc: {
14971497
(
14981498
options?:
14991499
| Intl.DateTimeFormatOptions & {
1500-
readonly locale?: string | undefined
1500+
readonly locale?: Intl.LocalesArgument
15011501
}
15021502
| undefined
15031503
): (self: DateTime) => string
15041504
(
15051505
self: DateTime,
15061506
options?:
15071507
| Intl.DateTimeFormatOptions & {
1508-
readonly locale?: string | undefined
1508+
readonly locale?: Intl.LocalesArgument
15091509
}
15101510
| undefined
15111511
): string

packages/effect/src/String.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ export const lastIndexOf = (searchString: string) => (self: string): Option.Opti
421421
* @since 2.0.0
422422
*/
423423
export const localeCompare =
424-
(that: string, locales?: Array<string>, options?: Intl.CollatorOptions) => (self: string): Ordering.Ordering =>
424+
(that: string, locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions) => (self: string): Ordering.Ordering =>
425425
number.sign(self.localeCompare(that, locales, options))
426426

427427
/**
@@ -549,7 +549,7 @@ export const search: {
549549
*
550550
* @since 2.0.0
551551
*/
552-
export const toLocaleLowerCase = (locale?: string | Array<string>) => (self: string): string =>
552+
export const toLocaleLowerCase = (locale?: Intl.LocalesArgument) => (self: string): string =>
553553
self.toLocaleLowerCase(locale)
554554

555555
/**
@@ -564,7 +564,7 @@ export const toLocaleLowerCase = (locale?: string | Array<string>) => (self: str
564564
*
565565
* @since 2.0.0
566566
*/
567-
export const toLocaleUpperCase = (locale?: string | Array<string>) => (self: string): string =>
567+
export const toLocaleUpperCase = (locale?: Intl.LocalesArgument) => (self: string): string =>
568568
self.toLocaleUpperCase(locale)
569569

570570
/**

packages/effect/src/internal/dateTime.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,23 +1051,23 @@ export const format: {
10511051
(
10521052
options?:
10531053
| Intl.DateTimeFormatOptions & {
1054-
readonly locale?: string | undefined
1054+
readonly locale?: Intl.LocalesArgument
10551055
}
10561056
| undefined
10571057
): (self: DateTime.DateTime) => string
10581058
(
10591059
self: DateTime.DateTime,
10601060
options?:
10611061
| Intl.DateTimeFormatOptions & {
1062-
readonly locale?: string | undefined
1062+
readonly locale?: Intl.LocalesArgument
10631063
}
10641064
| undefined
10651065
): string
10661066
} = dual(isDateTimeArgs, (
10671067
self: DateTime.DateTime,
10681068
options?:
10691069
| Intl.DateTimeFormatOptions & {
1070-
readonly locale?: string | undefined
1070+
readonly locale?: Intl.LocalesArgument
10711071
}
10721072
| undefined
10731073
): string => {
@@ -1089,23 +1089,23 @@ export const formatLocal: {
10891089
(
10901090
options?:
10911091
| Intl.DateTimeFormatOptions & {
1092-
readonly locale?: string | undefined
1092+
readonly locale?: Intl.LocalesArgument
10931093
}
10941094
| undefined
10951095
): (self: DateTime.DateTime) => string
10961096
(
10971097
self: DateTime.DateTime,
10981098
options?:
10991099
| Intl.DateTimeFormatOptions & {
1100-
readonly locale?: string | undefined
1100+
readonly locale?: Intl.LocalesArgument
11011101
}
11021102
| undefined
11031103
): string
11041104
} = dual(isDateTimeArgs, (
11051105
self: DateTime.DateTime,
11061106
options?:
11071107
| Intl.DateTimeFormatOptions & {
1108-
readonly locale?: string | undefined
1108+
readonly locale?: Intl.LocalesArgument
11091109
}
11101110
| undefined
11111111
): string => new Intl.DateTimeFormat(options?.locale, options).format(self.epochMillis))
@@ -1115,23 +1115,23 @@ export const formatUtc: {
11151115
(
11161116
options?:
11171117
| Intl.DateTimeFormatOptions & {
1118-
readonly locale?: string | undefined
1118+
readonly locale?: Intl.LocalesArgument
11191119
}
11201120
| undefined
11211121
): (self: DateTime.DateTime) => string
11221122
(
11231123
self: DateTime.DateTime,
11241124
options?:
11251125
| Intl.DateTimeFormatOptions & {
1126-
readonly locale?: string | undefined
1126+
readonly locale?: Intl.LocalesArgument
11271127
}
11281128
| undefined
11291129
): string
11301130
} = dual(isDateTimeArgs, (
11311131
self: DateTime.DateTime,
11321132
options?:
11331133
| Intl.DateTimeFormatOptions & {
1134-
readonly locale?: string | undefined
1134+
readonly locale?: Intl.LocalesArgument
11351135
}
11361136
| undefined
11371137
): string =>

0 commit comments

Comments
 (0)