Skip to content

Commit fa85ad8

Browse files
authored
[Beam] Fix DateTime tests to use InvariantCulture for locale independence (#4346)
1 parent e732f14 commit fa85ad8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/Beam/DateTimeTests.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,16 +410,25 @@ let ``test DateTime.ToString("d") works`` () =
410410

411411
[<Fact>]
412412
let ``test DateTime.ToShortTimeString works`` () =
413+
#if !FABLE_COMPILER
414+
Threading.Thread.CurrentThread.CurrentCulture <- CultureInfo.InvariantCulture
415+
#endif
413416
DateTime(2014, 9, 11, 16, 37, 0).ToShortTimeString()
414417
|> equal "16:37"
415418

416419
[<Fact>]
417420
let ``test DateTime.ToLongTimeString works`` () =
421+
#if !FABLE_COMPILER
422+
Threading.Thread.CurrentThread.CurrentCulture <- CultureInfo.InvariantCulture
423+
#endif
418424
DateTime(2014, 9, 11, 16, 37, 0).ToLongTimeString()
419425
|> equal "16:37:00"
420426

421427
[<Fact>]
422428
let ``test DateTime.ToLongDateString works`` () =
429+
#if !FABLE_COMPILER
430+
Threading.Thread.CurrentThread.CurrentCulture <- CultureInfo.InvariantCulture
431+
#endif
423432
DateTime(2014, 9, 11, 16, 37, 0).ToLongDateString()
424433
|> equal "Thursday, 11 September 2014"
425434

@@ -433,6 +442,9 @@ let ``test DateTime.ToShortDateString works`` () =
433442

434443
[<Fact>]
435444
let ``test DateTime.ToString("T") (upper) works`` () =
445+
#if !FABLE_COMPILER
446+
Threading.Thread.CurrentThread.CurrentCulture <- CultureInfo.InvariantCulture
447+
#endif
436448
DateTime(2014, 9, 11, 3, 37, 11, 345).ToString("T")
437449
|> equal "03:37:11"
438450

@@ -441,6 +453,9 @@ let ``test DateTime.ToString("T") (upper) works`` () =
441453

442454
[<Fact>]
443455
let ``test DateTime.ToString("t") (lower) works`` () =
456+
#if !FABLE_COMPILER
457+
Threading.Thread.CurrentThread.CurrentCulture <- CultureInfo.InvariantCulture
458+
#endif
444459
DateTime(2014, 9, 11, 3, 37, 11, 345).ToString("t")
445460
|> equal "03:37"
446461

0 commit comments

Comments
 (0)