donnytian / Npoi.Mapper

Use this tool to import or export data with Excel file. The tool is a convention based mapper between strong typed object and Excel data via NPOI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to map date to DateOnly datatype

rasupit opened this issue · comments

Mapping to DateOnly data type is not working or at least it can be done is not so straight forward way.

My current work around as follows:
`

            mapper.Map<FeedSapTivBill>("Invoice date", r => r.InvoiceDate, (s, t) => {
                if (s.HeaderValue == null) return false;

                ((FeedSapTivBill)t).InvoiceDate = DateOnly.FromDateTime((DateTime)s.CurrentValue);
                return true;
            }

It will be nice if it will work outomatically

commented

you already get Exact DateTime

you already get Exact DateTime

Yes, however I'm mapping it to DateOnly type, therefore I have to convert the value to DateOnly. In this example is from datetime