@fable-org/fable-library-ts 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.ts CHANGED
@@ -590,6 +590,18 @@ export function maxValue() {
590
590
  return DateTime(253402300799999, DateTimeKind.Utc);
591
591
  }
592
592
 
593
+ // The only date words .NET's invariant parser recognises: month names, weekday names,
594
+ // meridiem designators and zone markers (plus the ISO "T" separator). Anything else is
595
+ // rejected. Used to reject JS-permissive inputs (see `parseRaw`).
596
+ const recognizedDateWords = new Set([
597
+ "january", "february", "march", "april", "may", "june",
598
+ "july", "august", "september", "october", "november", "december",
599
+ "jan", "feb", "mar", "apr", "jun", "jul", "aug", "sep", "sept", "oct", "nov", "dec",
600
+ "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday",
601
+ "mon", "tue", "wed", "thu", "fri", "sat", "sun",
602
+ "am", "pm", "gmt", "utc", "ut", "t", "z",
603
+ ]);
604
+
593
605
  export function parseRaw(input: string): [Date, Offset] {
594
606
  function fail() {
595
607
  throw new Exception(`The string is not a valid Date: ${input}`);
@@ -599,6 +611,10 @@ export function parseRaw(input: string): [Date, Offset] {
599
611
  fail();
600
612
  }
601
613
 
614
+ if ((input.match(/[a-z]+/gi) ?? []).some(word => !recognizedDateWords.has(word.toLowerCase()))) {
615
+ fail();
616
+ }
617
+
602
618
  // ISO dates without TZ are parsed as UTC. Adding time without TZ keeps them local.
603
619
  if (input.length === 10 && input[4] === "-" && input[7] === "-") {
604
620
  input += "T00:00:00";
package/Util.ts CHANGED
@@ -84,6 +84,10 @@ export class Exception {
84
84
  constructor(msg?: string) {
85
85
  this.message = msg ?? "";
86
86
  }
87
+
88
+ toString() {
89
+ return this.message;
90
+ }
87
91
  }
88
92
 
89
93
  export function isException(x: any) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-ts",
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",