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: 
You can specify which parts to scaffold. The following is an excerpt from the ASP.NET Core documentation. Link to the source below.

**To disable user registration:**

* Scaffold Identity. Include Account.Register, Account.Login, and Account.RegisterConfirmation. For example:

```
dotnet aspnet-codegenerator identity -dc RPauth.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.RegisterConfirmation"

```

* Update *Areas/Identity/Pages/Account/Register.cshtml.cs* so users can't register from this endpoint:

```
public class RegisterModel : PageModel
{
    public IActionResult OnGet()
    {
        return RedirectToPage("Login");
    }

    public IActionResult OnPost()
    {
        return RedirectToPage("Login");
    }
}

```

* Update *Areas/Identity/Pages/Account/Register.cshtml* to be consistent with the preceding changes:

```
@page
@model RegisterModel
@{
    ViewData["Title"] = "Go to Login";
}

<h1>@ViewData["Title"]</h1>

<li class="nav-item">
    <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
</li>

```

* Comment out or remove the registration link from *Areas/Identity/Pages/Account/Login.cshtml*

```
@*
<p>
    <a asp-page="./Register" asp-route-returnUrl="@Model.ReturnUrl">Register as a new user</a>
</p>
*@

```

* Update the *Areas/Identity/Pages/Account/RegisterConfirmation* page.
	+ Remove the code and links from the cshtml file.
	+ Remove the confirmation code from the `PageModel`:

```
[AllowAnonymous]
public class RegisterConfirmationModel : PageModel
{
    public IActionResult OnGet()
    {  
        return Page();
    }
}

```

Source: <https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-2.2&tabs=visual-studio#disable-register-page>

More information about `dotnet aspnet-codegenerator`: <https://learn.microsoft.com/en-us/aspnet/core/fundamentals/tools/dotnet-aspnet-codegenerator>
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)));
        });

```