@@ -15,6 +15,10 @@ open System
15
15
[<MeasureAnnotatedAbbreviation>] type TimeSpan <[< Measure >] 'm > = TimeSpan
16
16
[<MeasureAnnotatedAbbreviation>] type DateTime <[< Measure >] 'm > = DateTime
17
17
[<MeasureAnnotatedAbbreviation>] type DateTimeOffset <[< Measure >] 'm > = DateTimeOffset
18
+ #if NET6_ 0_ OR_ GREATER
19
+ [<MeasureAnnotatedAbbreviation>] type DateOnly <[< Measure >] 'm > = DateOnly
20
+ [<MeasureAnnotatedAbbreviation>] type TimeOnly <[< Measure >] 'm > = TimeOnly
21
+ #endif
18
22
19
23
module private Unsafe =
20
24
let inline cast < 'a , 'b > ( a : 'a ) : 'b =
@@ -40,6 +44,10 @@ type UMX =
40
44
static member inline tag <[< Measure >] 'm > ( x : TimeSpan ) : TimeSpan < 'm > = Unsafe.cast x
41
45
static member inline tag <[< Measure >] 'm > ( x : DateTime ) : DateTime < 'm > = Unsafe.cast x
42
46
static member inline tag <[< Measure >] 'm > ( x : DateTimeOffset ) : DateTimeOffset < 'm > = Unsafe.cast x
47
+ #if NET6_ 0_ OR_ GREATER
48
+ static member inline tag <[< Measure >] 'm > ( x : DateOnly ) : DateOnly < 'm > = Unsafe.cast x
49
+ static member inline tag <[< Measure >] 'm > ( x : TimeOnly ) : TimeOnly < 'm > = Unsafe.cast x
50
+ #endif
43
51
44
52
static member inline untag <[< Measure >] 'm > ( x : bool < 'm >) : bool = Unsafe.cast x
45
53
static member inline untag <[< Measure >] 'm > ( x : byte < 'm >) : byte = Unsafe.cast x
@@ -55,6 +63,10 @@ type UMX =
55
63
static member inline untag <[< Measure >] 'm > ( x : TimeSpan < 'm >) : TimeSpan = Unsafe.cast x
56
64
static member inline untag <[< Measure >] 'm > ( x : DateTime < 'm >) : DateTime = Unsafe.cast x
57
65
static member inline untag <[< Measure >] 'm > ( x : DateTimeOffset < 'm >) : DateTimeOffset = Unsafe.cast x
66
+ #if NET6_ 0_ OR_ GREATER
67
+ static member inline untag <[< Measure >] 'm > ( x : DateOnly < 'm >) : DateOnly = Unsafe.cast x
68
+ static member inline untag <[< Measure >] 'm > ( x : TimeOnly < 'm >) : TimeOnly = Unsafe.cast x
69
+ #endif
58
70
59
71
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : bool < 'm1 >) : bool < 'm2 > = Unsafe.cast x
60
72
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : byte < 'm1 >) : byte < 'm2 > = Unsafe.cast x
@@ -70,6 +82,10 @@ type UMX =
70
82
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : TimeSpan < 'm1 >) : TimeSpan < 'm2 > = Unsafe.cast x
71
83
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : DateTime < 'm1 >) : DateTime < 'm2 > = Unsafe.cast x
72
84
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : DateTimeOffset < 'm1 >) : DateTimeOffset < 'm2 > = Unsafe.cast x
85
+ #if NET6_ 0_ OR_ GREATER
86
+ static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : DateOnly < 'm1 >) : DateOnly < 'm2 > = Unsafe.cast x
87
+ static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : TimeOnly < 'm1 >) : TimeOnly < 'm2 > = Unsafe.cast x
88
+ #endif
73
89
74
90
75
91
[<AutoOpen>]
0 commit comments