Skip to content

Commit

Permalink
use en-US locale in DateTime tests (#3443)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Aug 12, 2024
1 parent 739834e commit 8ac351e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/effect/src/DateTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ export const format: {
/**
* Format a `DateTime` as a string using the `DateTimeFormat` API.
*
* It will use the system's local time zone.
* It will use the system's local time zone & locale.
*
* @since 3.6.0
* @category formatting
Expand Down
19 changes: 16 additions & 3 deletions packages/effect/test/DateTime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ describe("DateTime", () => {
const now = yield* DateTime.now
assert.strictEqual(
DateTime.format(now, {
locale: "en-US",
dateStyle: "full",
timeStyle: "full"
}),
Expand All @@ -213,7 +214,11 @@ describe("DateTime", () => {
Effect.gen(function*() {
const now = yield* DateTime.now
assert.strictEqual(
DateTime.formatUtc(now, { dateStyle: "full", timeStyle: "full" }),
DateTime.formatUtc(now, {
locale: "en-US",
dateStyle: "full",
timeStyle: "full"
}),
"Thursday, January 1, 1970 at 12:00:00 AM Coordinated Universal Time"
)
}))
Expand All @@ -226,7 +231,11 @@ describe("DateTime", () => {
DateTime.withCurrentZoneNamed("Pacific/Auckland")
)
assert.strictEqual(
DateTime.format(now, { dateStyle: "full", timeStyle: "full" }),
DateTime.format(now, {
locale: "en-US",
dateStyle: "full",
timeStyle: "full"
}),
"Thursday, January 1, 1970 at 12:00:00 PM New Zealand Standard Time"
)
}))
Expand All @@ -236,7 +245,11 @@ describe("DateTime", () => {
const now = yield* DateTime.now
const formatted = now.pipe(
DateTime.setZoneOffset(10 * 60 * 60 * 1000),
DateTime.format({ dateStyle: "long", timeStyle: "short" })
DateTime.format({
locale: "en-US",
dateStyle: "long",
timeStyle: "short"
})
)
assert.strictEqual(formatted, "January 1, 1970 at 10:00 AM")
}))
Expand Down

0 comments on commit 8ac351e

Please sign in to comment.