@fable-org/fable-library-ts 1.8.0 → 1.9.0
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 +10 -0
- package/DateOffset.ts +4 -0
- package/TimeSpan.ts +12 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 1.9.0 - 2025-01-09
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
* [JS/TS] Add new `TimSpan` overload support coming from .NET 9 (by @MangelMaxime)
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
* [JS/TS] Fix `DateTimeOffset.ToLocalTime` (by @MangelMaxime)
|
|
19
|
+
|
|
10
20
|
## 1.8.0 - 2024-11-19
|
|
11
21
|
|
|
12
22
|
* [JS/TS] Fix `h` in `DateTime.ToString` (@MangelMaxime)
|
package/DateOffset.ts
CHANGED
|
@@ -166,6 +166,10 @@ export function toUniversalTime(date: IDateTimeOffset): Date {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
export function toLocalTime(date: IDateTimeOffset): Date {
|
|
169
|
+
return DateTime(date.getTime() + offset(now()), DateKind.Local);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function localDateTime(date: IDateTimeOffset) : Date {
|
|
169
173
|
return DateTime(date.getTime(), DateKind.Local);
|
|
170
174
|
}
|
|
171
175
|
|
package/TimeSpan.ts
CHANGED
|
@@ -35,20 +35,24 @@ export function fromTicks(ticks: number | bigint) {
|
|
|
35
35
|
return Number(BigInt(ticks) / 10000n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export function fromDays(d: number) {
|
|
39
|
-
return create(d,
|
|
38
|
+
export function fromDays(d: number, h: number = 0, m: bigint = 0n, s: bigint = 0n, ms: bigint = 0n) {
|
|
39
|
+
return create(d, h, Number(m), Number(s), Number(ms));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function fromHours(h: number) {
|
|
43
|
-
return create(h,
|
|
42
|
+
export function fromHours(h: number, m: bigint = 0n, s: bigint = 0n, ms: bigint = 0n) {
|
|
43
|
+
return create(0, h, Number(m), Number(s), Number(ms));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function fromMinutes(m: number) {
|
|
47
|
-
return create(0, m,
|
|
46
|
+
export function fromMinutes(m: number | bigint, s: bigint = 0n, ms: bigint = 0n) {
|
|
47
|
+
return create(0, 0, Number(m), Number(s), Number(ms));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export function fromSeconds(s: number) {
|
|
51
|
-
return create(0, 0, s);
|
|
50
|
+
export function fromSeconds(s: number | bigint, ms: bigint = 0n) {
|
|
51
|
+
return create(0, 0, 0, Number(s), Number(ms));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function fromMilliseconds(ms: number | bigint) {
|
|
55
|
+
return Number(ms);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
export function days(ts: TimeSpan) {
|
package/package.json
CHANGED