Open Closed

Different value for DateTime Picker and api request parameter #6011


User avatar
0
icoretchi created
  • ABP Framework version: v7.4.0
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): microservices
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
  1. Generate crud form with abp suite with DateTime properties
  2. The suite will generate Advanced Filters with DateTime Pickers
  3. Select the date for instance 18.10.2023
  4. But the request parameter in the api will be a different date. In my case is minus one date i.e. 17.10.2023


6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I think the data result is no problem, right?

  • User Avatar
    0
    icoretchi created

    Hi,

    What do you mean data result is correct? The problem is that I request wrong filtering conditions from the backend. On UI you see one date, but the backend results will be provided based on different dates.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Because the time of the parameter is UTC time.

    What do you mean data result is correct

    I mean, when you search, the data of 17.10.2023 time will not appear, right?

  • User Avatar
    0
    icoretchi created

    Hi,

    Actually I've searched for date ranges DateMin and DateMax. For DateMin is not a problem because the 17.10.2023 is less than 18.10.2023, but for DateMax if I use 18.10.2023 then the api request will contain the interval between 17.10.2023 and 17.10.2023. That means that the records with date 18.10.2023 will not be returned. In such way filtering will not work properly.

    Steps to reporduce:

    • Add record with date 18.10.2023
    • Select for DateMin 18.10.2023
    • Select for DateMax 18.102023 Expected result:
    • record will be in the list Actual result
    • record is not in the list

    I hope I am more explicit now.

    Thanks

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I will check it

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Yes, it's a problem. We will enhance the ABP suite:

    You can consider:

    protected virtual async Task OnDateMaxChangedAsync(DateTime? dateMax)
    {
        Filter.DateMax = dateMax == null ? null : dateMax.Value.Date.AddDays(1).AddSeconds(-1);
        await SearchAsync();
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38