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

This forum contains topics that were moved from Get Satisfaction
nica faustino
Posts: 0
Joined: Tue Oct 07, 2014 11:57 am

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

Post 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

nica faustino
Posts: 0
Joined: Tue Oct 07, 2014 11:57 am

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

Post 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...

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

Post by Kateryna Grynko »

Hi Nica,

Answered via email. Let's continue there.

nica faustino
Posts: 0
Joined: Tue Oct 07, 2014 11:57 am

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

Post 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!

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

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

Post 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

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

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

Post by Ellen Schlechter »

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

Post 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.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

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

Post 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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

Post 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.

Post Reply