DateTime format configuration doesn't work for CreateControllersForAppServices controllers
See original GitHub issueABP 3.6.1, .net core 2.0
This code runs correctly for common controllers. json is formatted.
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
});
But it doesn’t take effect on CreateControllersForAppServices controllers, json result is still like:
2018-05-15T17:26:43.2706968+08:00
and this also doesn’t work:
services.PostConfigure<MvcJsonOptions>(options =>
{
foreach (var converter in options.SerializerSettings.Converters)
{
if (converter is AbpDateTimeConverter timeConverter)
{
timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
}
}
});
Is there a bug? or what can I do to config the CreateControllersForAppServices controllers’ json format?
thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
DateTime format configuration doesn't work for ...
This code runs correctly for common controllers. json is formatted. services.AddControllersWithViews(options => { options.Filters.Add(new ...
Read more >Developers - DateTime format configuration doesn't work ...
This code runs correctly for common controllers. json is formatted. services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.
Read more >Trouble with binding DateTime and decimal when using ...
Recently I've migrated project to Core 2.2 and ABP 4.4. Since then I am having troubles with binding DateTime and decimals. It all...
Read more >Articles Tutorials | AspNet Boilerplate
It is properly integrated and configured to work with the ABP framework. ... To use Mvc datetime format options, you can set this...
Read more >DateTime not posting correctly to controller
Hello, I have an issue regarding the posting of a DateTimePicker value to a controller. Code is as follows: View: 1.@(Html.Kendo().
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@devsharper could you try it like below;
@ismcagdas I used this code swagger login time error (Uncaught TypeError: Cannot read property ‘expireInSeconds’ of undefined at XMLHttpRequest.xhr.onreadystatechange (abp.swagger.js:49))
using System; using System.Linq; using System.Reflection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Cors.Internal; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Castle.Facilities.Logging; using Swashbuckle.AspNetCore.Swagger; using Abp.AspNetCore; using Abp.Castle.Logging.Log4Net; using Abp.Extensions; using HR.BookList.Authentication.JwtBearer; using HR.BookList.Configuration; using HR.BookList.Identity;
using Abp.AspNetCore.SignalR.Hubs; using Microsoft.AspNetCore.Mvc; using Abp.Json; using Newtonsoft.Json.Serialization;
namespace HR.BookList.Web.Host.Startup { public class Startup { private const string _defaultCorsPolicyName = “localhost”;
{ app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework.
} } }