ozlerhakan / poiji

:candy: A library converting XLS and XLSX files to a list of Java objects based on Apache POI
MIT License
468 stars 134 forks source link

LocalDate is always parsed to current date #267

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi,

This is the part of my model

  @ExcelCellName("StartDate")
  private LocalDate startDate;

This is how I am using it

PoijiOptions options = PoijiOptionsBuilder.settings()
        .datePattern("dd/MM/yyyy")
        .sheetIndex(sheetIndex)
        .build();

    try {
      return Poiji.fromExcel(inputStream, PoijiExcelType.XLSX, clazz, options);
    } 

All the fields are correctly parsed but the startDate field is always getting parsed to current date. Attaching the screenshot for excel file

image

Am I missing anything?

github-actions[bot] commented 1 year ago

Thank you for contributing to Poiji! Feel free to create a PR If you want to contribute directly :)

ghost commented 1 year ago

Found out that its the duplicate of https://github.com/ozlerhakan/poiji/issues/166 so closing tis

ghost commented 1 year ago

Would it be possible to not use current date by default as it will lead to issues we won't know?

StephenR-Softcom commented 1 year ago

Hi, I had the same issue at first because the Excel date format was not what it looked like (it's not what's written in the formula bar).

In your Excel sheet, check the cell format for a StartDate field and specify that date format in the Poiji Options

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.