Parsing DateTime fails w/ NPOI 2.5.1
davesheldon opened this issue · comments
Dave Sheldon commented
Given class:
private class Sample {
[Display(Name = "Employee #")]
public string EmployeeID { get; set; }
[Display(Name = "Date Worked")]
public DateTime DateWorked { get; set; }
}
}
We are seeing failures mapping DateTimes when updating to NPOI 2.5.1.
The excel file we're receiving uses a custom date format of m/d/yyyy h:mm
. It parses correctly when we downgrade to our previous version (NPOI 2.4.1).
Donny Tian commented
hi, seems NPOI 2.5.1 brings some trouble for us.
Either specify format for a mapping:
mapper.Format<SampleClass>("m/d/yyyy h:mm", o => o.DateProperty);
Or specify for a type:
mapper.UseFormat(typeof(DateTime), "m/d/yyyy h:mm");
Tony Qu commented
This looks to be a bug of NPOI 2.5.1. @davesheldon can you open a issue in NPOI issues
Donny Tian commented
closing this, please try with the latest version