Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^

This commit is contained in:
Wei Lin 2024-05-16 22:20:03 +08:00
parent 361fb964f4
commit b24b35acad
6 changed files with 11 additions and 13 deletions

View File

@ -24,6 +24,7 @@
### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
- [Bug] Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^ #594
### 1.32.0
- [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak)

View File

@ -27,6 +27,7 @@
### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
- [Bug] Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^ #594
### 1.32.0
- [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak)

View File

@ -26,6 +26,7 @@
### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
- [Bug] Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^ #594
### 1.32.0
- [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak)

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<Version>1.32.0</Version>
<TargetFrameworks>net45;netstandard2.0;net6.0;</TargetFrameworks>
<Version>1.32.1</Version>
</PropertyGroup>
<PropertyGroup>
<AssemblyName>MiniExcel</AssemblyName>
@ -54,9 +54,4 @@ Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true</De
<ItemGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Portable.System.DateTimeOnly">
<Version>8.0.0</Version>
</PackageReference>
</ItemGroup>
</Project>

View File

@ -50,7 +50,7 @@ namespace MiniExcelLibs.OpenXml
// if sheets count > 1 need to read xl/_rels/workbook.xml.rels
var sheets = _archive.entries.Where(w => w.FullName.StartsWith("xl/worksheets/sheet", StringComparison.OrdinalIgnoreCase)
|| w.FullName.StartsWith("/xl/worksheets/sheet", StringComparison.OrdinalIgnoreCase)
);
).ToArray();
ZipArchiveEntry sheetEntry = null;
if (sheetName != null)
{
@ -73,14 +73,14 @@ namespace MiniExcelLibs.OpenXml
{
SetWorkbookRels(_archive.entries);
var s = _sheetRecords[0];
#if NET45
sheetEntry = sheets.Single(w => w.FullName == $"xl/{s.Path}" || w.FullName == $"/xl/{s.Path}");
#elif NETSTANDARD2_0_OR_GREATER
//#if NET45
// sheetEntry = sheets.Single(w => w.FullName == $"xl/{s.Path}" || w.FullName == $"/xl/{s.Path}");
//#else
// fixed by argo@live.ca
// s.Path = "/xl/sheets/sheet1.xml" s.FullName = "/xl/sheets/sheet1.xml"
sheetEntry = sheets.Single(w => w.FullName == $"xl/{s.Path}" || w.FullName == $"/xl/{s.Path}" || w.FullName.TrimStart('/') == s.Path.TrimStart('/'));
#endif
//#endif
}
else
sheetEntry = sheets.Single();

View File

@ -574,7 +574,7 @@ namespace MiniExcelLibs.OpenXml
cellValue = ((DateTime)value).ToString(columnInfo.ExcelFormat, _configuration.Culture);
}
}
#if NETSTANDARD2_0_OR_GREATER
#if NET6_0_OR_GREATER
else if (type == typeof(DateOnly))
{
if (_configuration.Culture != CultureInfo.InvariantCulture)