Question: I am getting a date string in this format - 'March 12 2019 11:30 pm' and also the offset in hours like +5.5. I want to convert this date into my browser timezone.

I have tried the following code

```
function convertToLocalTime(date, offset) {
  const serverTime = new Date(date);
  const localOffset = offset * 3600000;
  const d = new Date(serverTime.getTime() + localOffset).toUTCString();
  return new Date(d);
}

```

But I am getting the date as `Tue Mar 12 2019 15:30:00 GMT+0530 (India Standard Time)` which is wrong.

The expected result should be if the date is March 12 2019 11:30 pm and the offset given is -8 and my local time has an offset of +5.5, I should get the date as March 13 2019 12:00 pm.

`convertToLocalTime('March 12 2019 11:30 pm', -8)` 
should give the date as March 13 2019 12:00 pm.

Answer: 
Another option is just to remove Register link and redirect from register to login in your Startup class:

```
    app.UseEndpoints(endpoints =>
        {
            endpoints.MapGet("/Identity/Account/Register", context => Task.Factory.StartNew(() => context.Response.Redirect("/Identity/Account/Login", true, true)));
            endpoints.MapPost("/Identity/Account/Register", context => Task.Factory.StartNew(() => context.Response.Redirect("/Identity/Account/Login", true, true)));
        });

```
Another way to solve it is using Middleware, and blocking all routes with specific PageModels.

```cs
public class Startup {
    // ...
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        // ...
        app.UseRouting();

        var blockedPages = new [] {
            typeof(RegisterModel),
            typeof(RegisterConfirmationModel),
        };
        app.Use(async (context, next) =>
        {
            var pageActionDescriptor = context.GetEndpoint()?.Metadata.GetMetadata<PageActionDescriptor>();
            var page = (pageActionDescriptor as CompiledPageActionDescriptor)?.ModelTypeInfo.BaseType;

            if (blockedPages.Contains(page))
            {
                context.Response.Redirect("/");
                return;
            }
            await next.Invoke();
        });
    }
}

```