Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clock.Provider not working in abp v9 #6928

Open
yopichy opened this issue Apr 4, 2024 · 6 comments
Open

Clock.Provider not working in abp v9 #6928

yopichy opened this issue Apr 4, 2024 · 6 comments
Assignees
Milestone

Comments

@yopichy
Copy link

yopichy commented Apr 4, 2024

based on https://aspnetboilerplate.com/Pages/Documents/Timing, i set Clock.Provider = ClockProviders.Utc.
before upgrade in abp v7 (NET6), when API received payload "2024-01-01T00:00:00.000+07:00" in SomethingAppService will be auto convert to "2023-12-31 17:00:00" [kind=utc], but in v9 (NET8) still "2024-01-01 00:00:00" [kind=local]
image

@ismcagdas ismcagdas added this to the v9.2 milestone Apr 4, 2024
@yopichy
Copy link
Author

yopichy commented Apr 5, 2024

as additional info, this issue only happens on HTTP POST (kind = local). on HTTP GET it remains the same v7 (kind=utc).
Is there relationship with changes from newtonsoft to system.text.json #6679?

@ismcagdas ismcagdas modified the milestones: v9.2, v9.3 Apr 24, 2024
@ismcagdas ismcagdas self-assigned this May 10, 2024
@ismcagdas
Copy link
Member

@yopichy I couldn't reproduce this issue. Is it possible for you to prepare a solution which reproduces this problem ?

I downloaded a new template from https://aspnetboilerplate.com/Templates and created the app service below;

public interface ITestAppService : IApplicationService
{
    Task DoSomething(DoSomethingInput input);
}

public class DoSomethingInput
{
    public DateTime Date { get; set; }
}

public class TestAppService : Issue6928AppServiceBase, ITestAppService
{
    public Task DoSomething(DoSomethingInput input)
    {
        return Task.CompletedTask;
    }
}

Then, I send the request below;

image

Ahd this is the value I get;

image

@yopichy
Copy link
Author

yopichy commented May 13, 2024

@ismcagdas in startup clock provider using utc?

@yopichy
Copy link
Author

yopichy commented May 13, 2024

If using a new template, i cannot reproduce too. I'm upgrade from older version to v9

image
when POST param using like this, kind is correct UTC.
and i changed inside class back to local
image

Can you guess why this happened?

@ismcagdas
Copy link
Member

Can you compare your Startup.cs with the new project's Startup.cs ? It might help.

@yopichy
Copy link
Author

yopichy commented May 13, 2024

@ismcagdas I only saw a difference in the part where there was no .AddNewtonsoftJson in new template, is that the problem?
the problem only occurs using the POST method with parameter object/class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants