0

I am using the following code for the Date field in Blazor :

<DateEdit id="dateOfBirth" 
          TValue="DateTime?" 
          Class="form-control" 
          Date="BiographicalInformationData.DateOfBirth" 
          DateChanged="OnDateOfBirthChanged" >
</DateEdit>

Here, this datepicker picks up the date format of the System. How can one hard code the date format for this date picker?

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
Simran Kaur
  • 217
  • 1
  • 5
  • 15
  • It picks the format of the *browser*, which is the one selected by the *user's* regional settings. This affects only the display format, not the actual value. Why do you want to change that? – Panagiotis Kanavos Oct 04 '21 at 10:10
  • The `DateEdit` component emits a [native input type="date"](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#value) element whose display format is always that of the user's locale. From the docs: ` the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd.`. You'll have to use [DatePicker](https://blazorise.com/docs/components/date-picker/) instead, which renders a `text` field – Panagiotis Kanavos Oct 04 '21 at 10:20
  • You can also try to style the `date` field. Check [Is there any way to change input type="date" format?](https://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format) – Panagiotis Kanavos Oct 04 '21 at 10:22

0 Answers0