Skip to content

Commit

Permalink
Remove bug with Portable.System.DateTimeOnly and only support DateOnl…
Browse files Browse the repository at this point in the history
…y .NET6^
  • Loading branch information
shps951023 committed May 16, 2024
1 parent 361fb96 commit b24b35a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions docs/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions docs/README.zh-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 2 additions & 7 deletions src/MiniExcel/MiniExcelLibs.csproj
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -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>
10 changes: 5 additions & 5 deletions src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public IEnumerable<IDictionary<string, object>> Query(bool useHeaderRow, string
// 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)
{
Expand All @@ -73,14 +73,14 @@ public IEnumerable<IDictionary<string, object>> Query(bool useHeaderRow, string
{
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();
Expand Down
2 changes: 1 addition & 1 deletion src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ private Tuple<string, string, string> GetCellValue(int rowIndex, int cellIndex,
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)
Expand Down

0 comments on commit b24b35a

Please sign in to comment.