question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MTX_DATETIME_FORMATS not working

See original GitHub issue

I want to customize the datetime input display, but it is not working, I copy the example from the docs.

 providers: [
        {
            provide: MTX_DATETIME_FORMATS,
            useValue: {
                parse: {
                    dateInput: 'YYYY-MM-DD',
                    monthInput: 'MMMM',
                    timeInput: 'HH:mm',
                    datetimeInput: 'YYYY-MM-DD HH:mm',
                },
                display: {
                    dateInput: 'YYYY-MM-DD',
                    monthInput: 'MMMM',
                    timeInput: 'HH:mm',
                    datetimeInput: 'yyyy/MM/dd HH:mm:ss',
                    monthYearLabel: 'YYYY MMMM',
                    dateA11yLabel: 'LL',
                    monthYearA11yLabel: 'MMMM YYYY',
                    popupHeaderDateLabel: 'MMM DD, ddd',
                },
            },
        },
    ],

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Itaryncommented, Jan 19, 2022

I had the same error and after quite a bit of research it turns out that by adding { provide: DateAdapter, useClass: MomentDateAdapter } it works as expected.

1reaction
llyrowenjonescommented, Jan 20, 2022

I had the same error and after quite a bit of research it turns out that by adding { provide: DateAdapter, useClass: MomentDateAdapter } it works as expected.

I had to also install @angular/material-moment-adapter and @ng-matero/extensions-moment-adapter to use the adapter.

I followed @nzbin’s above link after installing these to make it work as I wanted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change angular material datepicker format
this format. Please help me, I am unable to convert date in YYYY-MM-DD or YYYY-MM-DDTHH:mm format.
Read more >
24 Working with dates and times - Stata
1. You begin with the datetime variables in your data however they are recorded, such as 21nov2006 or 11/21/2006 or November 21, 2006 ......
Read more >
Date format in Grid | Angular - EJ 2 Forums - Syncfusion
there are another problem by doing it with format datetime. I want to show dateTime column by locale, but I am always get...
Read more >
How to Fix Excel Dates That Won't Change Format - Contextures
Problem Excel Dates. If you import data into a Microsoft Excel spreadsheet, and try to format a column of dates, sometimes the dates...
Read more >
Standard date and time format strings | Microsoft Learn
The "O" or "o" standard format specifier corresponds to the "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK" custom format string for DateTime values ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found