Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 4bc85c3

Browse files
author
Angelo Pirola
committed
Refactoring
1 parent b947b2b commit 4bc85c3

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/NET6CustomLibrary/DateTime/Converters/UtcDateTimeConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ public override System.DateTime Read(ref Utf8JsonReader reader, Type typeToConve
1717
=> reader.GetDateTime().ToUniversalTime();
1818

1919
public override void Write(Utf8JsonWriter writer, System.DateTime value, JsonSerializerOptions options)
20-
=> writer.WriteStringValue((value.Kind == DateTimeKind.Local ? value.ToUniversalTime() : value).ToString(serializationFormat));
20+
=> writer.WriteStringValue((value.Kind == DateTimeKind.Local ? value.ToUniversalTime() : value)
21+
.ToString(serializationFormat));
2122
}

src/NET6CustomLibrary/DateTime/TypeConverters/DateOnlyTypeConverter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace NET6CustomLibrary.DateTime.TypeConverters;
22

3-
public class DateOnlyTypeConverter : TypeConverter
3+
#if NET6_0
4+
internal class DateOnlyTypeConverter : TypeConverter
45
{
56
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
67
{
@@ -41,4 +42,5 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
4142

4243
return base.ConvertTo(context, culture, value, destinationType);
4344
}
44-
}
45+
}
46+
#endif

src/NET6CustomLibrary/DateTime/TypeConverters/TimeOnlyTypeConverter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace NET6CustomLibrary.DateTime.TypeConverters;
22

3+
#if NET6_0
34
public class TimeOnlyTypeConverter : TypeConverter
45
{
56
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
@@ -41,4 +42,5 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
4142

4243
return base.ConvertTo(context, culture, value, destinationType);
4344
}
44-
}
45+
}
46+
#endif

0 commit comments

Comments
 (0)