diff options
author | Steve Sanderson <SteveSandersonMS@users.noreply.github.com> | 2022-08-03 18:27:49 +0300 |
---|---|---|
committer | Steve Sanderson <SteveSandersonMS@users.noreply.github.com> | 2022-08-04 15:51:50 +0300 |
commit | 3aaaa4155cb2ec473f2eadda85bbc15703ce76a6 (patch) | |
tree | 54504f3963818cc6205c49d3a20c2ee02145f901 | |
parent | ea70568ba0bd91a349874cb8936d5de6d61e986b (diff) |
On FetchData pages, show date only (not time). Fixes https://github.com/dotnet/aspnetcore/issues/42345
5 files changed, 5 insertions, 5 deletions
diff --git a/src/content/Angular-CSharp/Controllers/WeatherForecastController.cs b/src/content/Angular-CSharp/Controllers/WeatherForecastController.cs index 06c83ba..219983c 100644 --- a/src/content/Angular-CSharp/Controllers/WeatherForecastController.cs +++ b/src/content/Angular-CSharp/Controllers/WeatherForecastController.cs @@ -29,7 +29,7 @@ public class WeatherForecastController : ControllerBase { return Enumerable.Range(1, 5).Select(index => new WeatherForecast { - Date = DateTime.Now.AddDays(index), + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)] }) diff --git a/src/content/Angular-CSharp/WeatherForecast.cs b/src/content/Angular-CSharp/WeatherForecast.cs index 79d043e..f185c90 100644 --- a/src/content/Angular-CSharp/WeatherForecast.cs +++ b/src/content/Angular-CSharp/WeatherForecast.cs @@ -2,7 +2,7 @@ namespace Company.WebApplication1; public class WeatherForecast { - public DateTime Date { get; set; } + public DateOnly Date { get; set; } public int TemperatureC { get; set; } diff --git a/src/content/React-CSharp/ClientApp/src/components/FetchData.js b/src/content/React-CSharp/ClientApp/src/components/FetchData.js index ab4115f..1b9d68d 100644 --- a/src/content/React-CSharp/ClientApp/src/components/FetchData.js +++ b/src/content/React-CSharp/ClientApp/src/components/FetchData.js @@ -17,7 +17,7 @@ export class FetchData extends Component { static renderForecastsTable(forecasts) { return ( - <table className='table table-striped' aria-labelledby="tableLabel"> + <table className="table table-striped" aria-labelledby="tableLabel"> <thead> <tr> <th>Date</th> diff --git a/src/content/React-CSharp/Controllers/WeatherForecastController.cs b/src/content/React-CSharp/Controllers/WeatherForecastController.cs index 06c83ba..219983c 100644 --- a/src/content/React-CSharp/Controllers/WeatherForecastController.cs +++ b/src/content/React-CSharp/Controllers/WeatherForecastController.cs @@ -29,7 +29,7 @@ public class WeatherForecastController : ControllerBase { return Enumerable.Range(1, 5).Select(index => new WeatherForecast { - Date = DateTime.Now.AddDays(index), + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)] }) diff --git a/src/content/React-CSharp/WeatherForecast.cs b/src/content/React-CSharp/WeatherForecast.cs index 79d043e..f185c90 100644 --- a/src/content/React-CSharp/WeatherForecast.cs +++ b/src/content/React-CSharp/WeatherForecast.cs @@ -2,7 +2,7 @@ namespace Company.WebApplication1; public class WeatherForecast { - public DateTime Date { get; set; } + public DateOnly Date { get; set; } public int TemperatureC { get; set; } |