@fable-org/fable-library-js 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- last_commit_released: 63bcd3d90f37cb3934edcc59b5f54f49ffab3896
2
+ last_commit_released: 15eb83ed36657f75073fb0e1b4cac677e24fc9bb
3
3
  updaters:
4
4
  - package.json:
5
5
  file: package.json
@@ -15,6 +15,15 @@ All notable changes to this project will be documented in this file.
15
15
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
16
16
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
17
17
 
18
+ ## 2.1.1 - 2026-06-10
19
+
20
+ ### 🐞 Bug Fixes
21
+
22
+ * *(js/ts)* Reject JS-permissive date strings that .NET TryParse rejects (#4588) ([09003de](https://github.com/fable-compiler/Fable/commit/09003de8bc72e4f73281828d905d49aab7db3f55))
23
+ * *(js/ts)* Make Exception.ToString() return the message instead of "Exception" (#4635) ([4c36f76](https://github.com/fable-compiler/Fable/commit/4c36f761bd378da800e30657c58355bd5324a653))
24
+
25
+ <strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/63bcd3d90f37cb3934edcc59b5f54f49ffab3896..15eb83ed36657f75073fb0e1b4cac677e24fc9bb)</small></strong>
26
+
18
27
  ## 2.1.0 - 2026-05-28
19
28
 
20
29
  ### 🚀 Features
package/Date.js CHANGED
@@ -554,6 +554,17 @@ export function maxValue() {
554
554
  // This is "9999-12-31T23:59:59.999Z", actual JS max value is 8640000000000000
555
555
  return DateTime(253402300799999, DateTimeKind.Utc);
556
556
  }
557
+ // The only date words .NET's invariant parser recognises: month names, weekday names,
558
+ // meridiem designators and zone markers (plus the ISO "T" separator). Anything else is
559
+ // rejected. Used to reject JS-permissive inputs (see `parseRaw`).
560
+ const recognizedDateWords = new Set([
561
+ "january", "february", "march", "april", "may", "june",
562
+ "july", "august", "september", "october", "november", "december",
563
+ "jan", "feb", "mar", "apr", "jun", "jul", "aug", "sep", "sept", "oct", "nov", "dec",
564
+ "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday",
565
+ "mon", "tue", "wed", "thu", "fri", "sat", "sun",
566
+ "am", "pm", "gmt", "utc", "ut", "t", "z",
567
+ ]);
557
568
  export function parseRaw(input) {
558
569
  function fail() {
559
570
  throw new Exception(`The string is not a valid Date: ${input}`);
@@ -561,6 +572,9 @@ export function parseRaw(input) {
561
572
  if (input == null || input.trim() === "") {
562
573
  fail();
563
574
  }
575
+ if ((input.match(/[a-z]+/gi) ?? []).some(word => !recognizedDateWords.has(word.toLowerCase()))) {
576
+ fail();
577
+ }
564
578
  // ISO dates without TZ are parsed as UTC. Adding time without TZ keeps them local.
565
579
  if (input.length === 10 && input[4] === "-" && input[7] === "-") {
566
580
  input += "T00:00:00";
package/Util.js CHANGED
@@ -9,6 +9,9 @@ export class Exception {
9
9
  constructor(msg) {
10
10
  this.message = msg ?? "";
11
11
  }
12
+ toString() {
13
+ return this.message;
14
+ }
12
15
  }
13
16
  export function isException(x) {
14
17
  return x instanceof Exception || x instanceof Error;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-js",
6
- "version": "2.1.0",
6
+ "version": "2.1.1",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",