Page 3 of 6

DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Fri Oct 10, 2014 2:08 pm
by nica faustino

Hi Evgene,
I've tried Google Chrome Developer Tools... That is what I can see at the Headers of the Attendance.../db/collections.

The date parameter seems to be in the correct format yyyy-mm-dd as the DB requires it.

Location: "Long Ashton"
acl: {*:{write:true, read:true}}
date: "2014-10-19"
notes: ""
present: true
student: "Mitsuki Faustino"

However, my newly created row into the DB still has a blank date column.

I admit that I haven't used the Chrome Developer Tools previously and would think that I am not even looking at the right place?! Please be specific to where I should look and what I should look for.

Thanks for any guidance you can provide!
Nica


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Fri Oct 10, 2014 2:22 pm
by nica faustino

In another attempt, find below the Request Payload, view source.

{"acl":{"*":{"write":true,"read":true}},"student":"Taiki Faustino","Location":"Long Ashton","date":"2014-10-08","present":true,"notes":""}

Again, it seems that the date format is being passed as a parameter in the correct format (e.g. yyyy-mm-dd).

Hmmm...


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Mon Oct 13, 2014 7:56 pm
by Kateryna Grynko

Hi Nica,

Answered via email. Let's continue there.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Mon Oct 13, 2014 10:03 pm
by nica faustino

"make sure the column is named 'date' (case-sensitive, no spaces in name) and is of date type."

Thanks Kateryna!!!

Just sharing with you and the community that by changing the database column name from "Date" to "date" (all lowercase), fixed the issue.

I guess Date was causing engine/database confusion!?!

Happy user again. THANK YOU!


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Wed Dec 10, 2014 3:41 am
by Ellen Schlechter

How do I do this with the new builder? Would the JS go where it is highlighted in the picture below? Image


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Wed Dec 10, 2014 5:51 am
by Yurii Orishchuk

yes.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Wed Dec 10, 2014 5:11 pm
by Ellen Schlechter

That didn't seem to work for me...


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Thu Dec 11, 2014 1:16 pm
by Evgene Karachevtsev

Ellen,

Please provide us with some details.
the right format for Database column with date type is "yyyy-mm-dd hh:mm:ss.mmm"
You can try to run this code in your console to be sure
prevar d = new Date();
console.log(d.toISOString().replace("T"," ").replace("Z",""));/pre
The code outputs a current date.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Thu Dec 11, 2014 6:47 pm
by Ellen Schlechter

I pasted it in the console and it game the current date and time. In the properties for the date picker it is yy-mm-dd. I would like it to be displayed mm-dd-yy with out the time if possible.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Fri Dec 12, 2014 5:57 am
by Yurii Orishchuk

Hi Ellen,

Please read this thread again and you will find following js code:

pre

var parts = value.split("/");
return parts[2] + "-" +parts[1] + "-" +parts[0];

/pre

You can change this code as you need.

It's custom js code and logic. So you need to write it yourself.

Regards.