Skip to content

DateTime incoherent value #649

Closed
@eJJonatah

Description

@eJJonatah

I'm using the ExcelDataReader library to read an excel file that comes from an API web request

i read the content as Stream and pass it into the ExcelReaderFactory.CreateReader.
All works really well but, in the target table there is a date column that is being read with the wrong value.
The column is in the positon 14 of the table and is the only date column in that table so it cannot be mispositioning.
All The values from that column start in year 2023 and represent deadlines for orders. For some reason, whenever i try to
read the value in the IExcelDataReader i allways receive the value 31/08/2019, allways. I tried debugging into the library but
i couldn't find the reason why this is happening in this case. I have a copy of that table and can ensure that none of the orders have their deadline prior to 2021.

	PendingInfo[] pendings;
        using (pendingTitlesReport )// the httpresponse message
        using (var reportbin = await pendingTitlesReport.Content.ReadAsStreamAsync())
        using (var filereader = ExcelReaderFactory.CreateReader(reportbin))
        {
            pendings = new PendingInfo[filereader.RowCount - 1];
            filereader.Read(); // start the reading
            for (int index = 0; filereader.Read();)
            {
                pendings[index++] = new PendingInfo
                {
                    EndOfCteCode = (string)filereader[EndCTEColumn],
                    BruteValue = (int)Convert.ChangeType(filereader[BruteValueColumn], typeof(int)),
                    ExpiringDate = DateOnly.FromDateTime(((DateTime)filereader[ExpiringDateColumn]))
                };
            }
        }

debugging:
image
logreport
dates

any idea what could be causing this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions