@@ -15,6 +15,10 @@ open System
1515[<MeasureAnnotatedAbbreviation>] type TimeSpan <[< Measure >] 'm > = TimeSpan
1616[<MeasureAnnotatedAbbreviation>] type DateTime <[< Measure >] 'm > = DateTime
1717[<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
1822
1923module private Unsafe =
2024 let inline cast < 'a , 'b > ( a : 'a ) : 'b =
@@ -40,6 +44,10 @@ type UMX =
4044 static member inline tag <[< Measure >] 'm > ( x : TimeSpan ) : TimeSpan < 'm > = Unsafe.cast x
4145 static member inline tag <[< Measure >] 'm > ( x : DateTime ) : DateTime < 'm > = Unsafe.cast x
4246 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
4351
4452 static member inline untag <[< Measure >] 'm > ( x : bool < 'm >) : bool = Unsafe.cast x
4553 static member inline untag <[< Measure >] 'm > ( x : byte < 'm >) : byte = Unsafe.cast x
@@ -55,6 +63,10 @@ type UMX =
5563 static member inline untag <[< Measure >] 'm > ( x : TimeSpan < 'm >) : TimeSpan = Unsafe.cast x
5664 static member inline untag <[< Measure >] 'm > ( x : DateTime < 'm >) : DateTime = Unsafe.cast x
5765 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
5870
5971 static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : bool < 'm1 >) : bool < 'm2 > = Unsafe.cast x
6072 static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : byte < 'm1 >) : byte < 'm2 > = Unsafe.cast x
@@ -70,6 +82,10 @@ type UMX =
7082 static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : TimeSpan < 'm1 >) : TimeSpan < 'm2 > = Unsafe.cast x
7183 static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : DateTime < 'm1 >) : DateTime < 'm2 > = Unsafe.cast x
7284 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
7389
7490
7591[<AutoOpen>]
0 commit comments