0

I am build a simple task manager where a form has two input text fields of title and description and one date field using jquery datepicker. I have displayed my data in table and used parse.com as my backend to store and retrieve data. My problem is when I set my date object using parse.js I face these problem i.e

 var sDate=new Date($(".date-task").val()); //Date {Tue Jun 26 2012 00:00:00 GMT+0530 (IST)}

var todo = new TodoList();

todo.set('dueon',sDate); // this is how I set the value in parse

todo.save();

But when I go to parse .com the date is saved to previous date ie Mon Jun 25 2012 18:30:00 GMT

when I check the post in firebug the date is posted as

 __type     "Date"

iso   "2012-06-25T18:30:00.000Z"

how do I save the correct date in data browser of parse.com

1
  • hey guys plz help,someone must have used parse.com using javascript Commented Jun 26, 2012 at 13:38

1 Answer 1

1

The posted date is correct since "Tue Jun 26 2012 00:00:00 GMT+0530 (IST)" is the same as "Mon Jun 25 2012 18:30:00 GMT" and Parse uses Unix timestamps which are in the GMT timezone.

Basically you just have to convert the date from GMT to your timezone (IST in this case). You can look at this question to see how it's done.

Sign up to request clarification or add additional context in comments.

3 Comments

thnks for the reply. I have retrieved and displayed the date properly in my view in IST from parse but how do I get IST date in data browser of parse.com
I mean the created and updated date matches Tue Jun 26 2012 00:00:00 GMT
@Nitish: I don't know that since I haven't used that tool. Perhaps there is some sort of configuration that allows the user to set the timezone.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.