Starts in:
2 DAYS
9 HRS
47 MIN
16 SEC
Starts in:
2 D
9 H
47 M
16 S
Open Closed

How i can change format input date controll from mm/dd/yyyy to dd/mm/yyyy #1187


User avatar
0
devteam created

I want to change format from mm/dd/yyyy to dd/mm/yyyy when i click choose date in date controll with input type="date". Please show me how to do that. I want to show 24/04/2021 in this controll.

  • ABP Framework version: v5.13.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

2 Answer(s)
  • User Avatar
    0
    Mehmet created

    Hi @devteam

    The DateParserFormatter exposed by @abp/ng.core package sets the ng-bootstrap's date format. You can see this: https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts#L51

    It gets the date format from application-configuration response (applicationConfiguration.localization.currentCulture.dateTimeFormat.shortDatePattern). So the date format is determined from the backend according to current language. You can change the format in the backend or override the DateParserFormatter class in the Angular UI like this:

    // app.module.ts
    import { DateParserFormatter } from '@abp/ng.core';
    
    //...
    
    providers: [{provide: DateParserFormatter, useClass: YourDateParserFormatter}]
    

    @maliming will help you for the backend configuration.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    For backend

    Override the AbpApplicationConfigurationAppService service and replace the following method:

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs#L25 https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs#L184 https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs#L221

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06