In my custom LWC component, I out put a date-type field using lightning-output-field tag, and it is formatted by default 'YYYY-MM-DD',

is it possible to show 'YYYY/MM/DD' using lightning-output-field and lightning-input-field?

Or I have to use lightning-input tag?

1 Answer 1


lightning-output-field and lightning-input-field respect running users' locale.

from documentation

...if field-name references a date and time value, then the default output value contains the date and time in the user's locale.

That means, that you can control it by changing the user's locale. So for users with different locals, this field will be displayed in different formats.

If you want to have some static format of date, you'll need to use lightning-input and to set desired date format.

  • perfect, thank you.
    – Lanjinest
    Commented Feb 19, 2021 at 3:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .