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

Nitish
  • 57
  • 4
  • 14

1 Answers1

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.

Community
  • 1
  • 1
pablochan
  • 5,625
  • 27
  • 42
  • 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 – Nitish Jun 25 '12 at 12:35
  • I mean the created and updated date matches Tue Jun 26 2012 00:00:00 GMT – Nitish Jun 25 '12 at 12:38
  • @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. – pablochan Jun 25 '12 at 14:08