Base solution for your next web application

Activities of "gekko"

Hi, thank you, I will try it that way.

Hi, I have the same issue. For me it works correctly on Chrome, but on Edge I can reproduce the issue. On Edge I have to refresh the page, then the updated logo is shown.

Hi @ismcagdas

sorry for the late reply.

I did now test it, and with the changes to DateTimeStyles.RoundtripKind in MyDateTimeConverter and MyNullableDateTimeConverter it works for me 👍.

Thank you

Hi, I did all the suggested modifications, but actually it does not change anything.

I tried to set a couple of breakpoints in the classes I added, but they are never hit.? The only breakpoint that hits is the initialization of the MyAbpDateTimeJsonTypeInfoResolver in Startup. In Startup.cs, the values for aspNetCoreConfiguration.InputDateTimeFormats and aspNetCoreConfiguration.OutputDateTimeFormat are both null at the moment it gets called. Is that expected?

Basically MyAbpDateTimeJsonTypeInfoResolver is the same as AbpDateTimeJsonTypeInfoResolver from aspnetboilerplate (and the other classes are almost same). So what should change with this implementation?

Hi, I tried your suggested change. Actually, if I send a change to the api, the date(s) are then of kind Utc as expected.

However, it does also change the dates format when data is fetched with a get request. With Clock.Provider = ClockProviders.Utc all dates are then formatted as Utc too. That, unfortunately breaks all the parts where we deal with dates and times in our client applications, because before the change the dates in get requests were not formatted as UTC.

If we would start from scratch this would not be a problem. But we have to deal with this all over the place, and not only in the angular app, but also in mobile apps too.

But that is not the only problem. The even bigger problem is, because we do not only have the angular app as a client, but also mobile app(s) on Appstores. From the moment we would publish the api change and with that the current behaviour, our client apps would be broken. We do not have control that all the client apps are then immediately updated. So we risk that customers app is broken, or wrong data is displayed or edited...

Is there a way to control the behavior more precisely so that it behaves as before? Sure, we can let .AddNewtonsoftJson() in Startup.cs for the moment. But we'd prefer to make it compatible with our solution without it. What I still don't get is, why the JsonDateTimeConverter does not work.

using System;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace custom.JsonConverters
{
    public class JsonDateTimeConverter : JsonConverter<DateTime>
    {
        public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            return DateTime.Parse(reader.GetString()).ToUniversalTime();
        }

        public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
        {
            writer.WriteStringValue(value.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"));
        }
    }
}

Because I made a similar one, a JsonDoubleConverter (because with another issue with double values), and that one was actually applied.

Showing 1 to 5 of 5 entries