Date Field won't populate from DB

I"m sure I’m missing something simple here.

I have a date field on an update form and want to populate the date field.

<input type="date" class="form-control form-control-lg" id="inp_date" name="date" dmx-bind:value="conn_moveDetail.data.query1.date.formatDate(&quot;MM/dd/yyyy&quot;)" aria-describedby="inp_date_help" placeholder="Enter Date">

I’ve tried formatting the date a bunch of different ways to get it to populate but to no avail. If I change it to a text field then it shows the date correctly.

Any ideas?

What browser are you using? Have you tried a different browser?

I was trying on mobile also. But I’ll try the backup browsers.

Been testing in Chrome

same on chrome, firefox and safari on my iphone. I know it has to do with how I’m formatting the date field?

If you leave the date un-formatted does it display, and how is it stored in your database?

unformatted doesn’t display.

database is microsoft SQL
field is a date field

How does it look in the json response from Server Connect (via Developer Console)?

You need to format in a specific manner:

var1.datetime.formatDate(&quot;yyyy-MM-dd&quot;)
2 Likes

I’m sure Ken is the same Ken in Clarke Kent!

But without the hair and good looks. :slight_smile:

1 Like

I think this might be the magic. I’m getting it to at least show a date now, its the wrong date, but I’ll dig into that for a sec.

please hold.

It’ll work…a date input has to have that specific format when setting the value, and the displayed format is determined by the locale of the users browser.

I still think you have a cape and a phone box somewhere close Ken!

:slight_smile:

1 Like

This is the formatting that worked. Its been a long day. I knew it was something in my formatting.

Thanks @mebeingken

2 Likes

They call him “The Witcher” these days - he is slaying all the bad bugs :slight_smile:

3 Likes

Even a broken clock is correct twice a day. :slight_smile:

1 Like

Having been a long time DMXzone guy, I’m glad to see a lot more people that are on the same time zone as I am for help in this forum. Its a life saver. I usually don’t have problems until late in the day when I start getting burnt, and in the old days that was past Europe business hours.

2 Likes

Happy to help from PST!

I can break stuff at this time of night and not get frantic calls from clients worrying they caused a problem or telling me something doesn’t work properly :slight_smile:

1 Like