[SOLVED] CalendarPicker not respecting date format

Get help with using Metro 4 components
Post Reply
shnar
Posts: 6
Joined: Mon Nov 26, 2018 12:52 pm
Status: Offline

[SOLVED] CalendarPicker not respecting date format

Post by shnar » Mon Nov 26, 2018 1:16 pm

I'm attempting to use the CalendarPicker and want it to display month/day/year. Here's my C# Razor code:

Code: Select all

<div class="form-group">
  <p>End Date:</p>
  <input type="text" name="endDate" value="@(((DateTime)ViewBag.EndDate).ToString("MM/dd/yyyy"))" data-role="calendarpicker" data-input-format="%m/%d/%y" />
</div>
When I load the page, no matter what value I put in the "data-input-format" attribute, the calendar always displays "yyyy/mm/dd". What am I doing wrong?

-shnar

User avatar
olton
Site Admin
Posts: 133
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Mon Nov 26, 2018 1:48 pm

for display selected data use attribute data-format: https://metroui.org.ua/calendarpicker.h ... ker_output

Code: Select all

data-format="%m/%d/%y"

shnar
Posts: 6
Joined: Mon Nov 26, 2018 12:52 pm
Status: Offline

Post by shnar » Wed Nov 28, 2018 3:16 pm

That worked. Thanks a bundle.

-shnar

Post Reply