Base solution for your next web application
Open Closed

Issue while displaying the Date #7082


User avatar
0
mujthabagroad created

Hello Team,

We are facing some issues with date manipulation, it inserts into DB with UTC format, but when retrieving the data in CRUD table shows in UTC date and while editing the data it shows invalid date, some time shows the wrong value, the menu was generated using RAD Tool.

Gone through the Timing documentation and tried with **ClockProviders **option and timezone settings in the administration settings menu, but no change, we need to save the data in UTC and display the data in local format. Attaching ADD/TABLE/EDIT views for the reference.

Add a new record: On Table:

Edit View:


11 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mujthabagroad

    Are you working on Angular or JQuery version ?

  • User Avatar
    0
    mujthabagroad created

    Hi,

    Angular v6.8.0

  • User Avatar
    0
    mujthabagroad created

    Hi,

    Awaiting for the reply.

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mujthabagroad

    Does that work when you use Date instead of MomentJS as the NSWAG date type ?

    You need to regenerate the service proxies after making this change.

  • User Avatar
    0
    mujthabagroad created

    Tried with that. but it displays in UTC, not converting to local time with local timezone. need to change overall application where it depends on it right?. how it can be fixed with MomentJS without changing the type?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mujthabagroad

    Could it be related to https://github.com/aspnetzero/aspnet-zero-core/issues/2043 ?

  • User Avatar
    0
    mujthabagroad created

    Let me try this and get back you.

    Thanks.

  • User Avatar
    0
    mujthabagroad created

    Hi, As per the discussion, need to change: [(ngModel)]="entity.dateField "<span class="colour" style="color: rgb(36, 41, 46);"> to </span>[(ngModel)]="entity.dateField._d"<span class="colour" style="color: rgb(36, 41, 46);"> in datepicker input.</span> <span class="colour" style="color: rgb(36, 41, 46);">Also, initialize your date fields (</span>this.entity.dateField = moment();<span class="colour" style="color: rgb(36, 41, 46);">) in show method after </span>= new CreateOrEditEntityDto();

    so we should add this for all datepickers other than RAD generated views right. how it can be if it is a date and time picker?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @mujthabagroad

    Are you using latest version of RAD Tool ? As I remember, we have already fixed this problem. It should be same for date-time pickers since date information also contains time.

  • User Avatar
    0
    mujthabagroad created

    Okay, we have generated it initially and may not be included at that time, we will change it accordingly.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @mujthabagroad

    We will try to fix the problem with Rad Tool as well.