error in getSFDate

  • 1
  • Problem
  • Updated 4 years ago
  • Not a Problem
When we get a date from the model and try and convert it to a java script date, it throws and internal skuid error. Advice?

x=skuid.model.getModel('MMA_Private_Lesson_Enrollment').data;[ObjectAdditional_Charges_for_Student__c: 0Base_Install_Amt__c: 97.5Contracted_Bookings_Total__c: 18Contracted_Total_Bookings_Price__c: 1170Enrollment_End_Date__c: "2015-01-23"Enrollment_Start_Date_Time__c: "2014-08-29T18:40:00.000+0000"First_Install_Date__c: "2014-08-01"Google_Enrollment_Spreadsheet__c: "https://docs.google.com/a/musicallyminded.com/spreadsheets/d/16jqkoNamfIGjtCZ6CRPpG6BHVPBK5gDeC0A726...: "a98U00000004CF4IAM"Id15: "a98U00000004CF4"Instructor_Pay_Rate_and_Lesson_Duration__c: "a91U00000008OIPIA2"Instructor_Pay_Rate_and_Lesson_Duration__r: ObjectMMA_Academic_Season_s_Term__c: "a4XU00000004DVMMA2"MMA_Academic_Season_s_Term__r: ObjectMMA_Enrollment_Status__c: "a6FU00000004DfrMAE"MMA_Enrollment_Status__r: ObjectMMA_Instructor__c: "a0rU0000000PK85IAG"MMA_Instructor__r: ObjectMMA_Private_Lesson__c: "a7HU0000000PBaaMAG"MMA_Private_Lesson__r: ObjectMMA_Student_Record__c: "a7RU0000000GsOLMA0"MMA_Student_Record__r: ObjectName: "Gish, Alex:14FS:PL:45"Number_of_Minutes_from_Private_Lesson__c: 45Payment_Plan__c: trueRegistration_Fee__c: 0Student_Age__c: 8Total_Tuition_Bookings_Registration__c: 1170attributes: Objectof_Installments__c: 12of_Mins_owed_to_student__c: 45of_lessons_owed_to_student__c: 1owed_Student_if_bookings_not_increased__c: 65__proto__: Object]
y=x[0].First_Install_Date__c;
"2014-08-01"
z=skuid.time.getSFDate(y);
skuid__SkuidJS:25 Uncaught TypeError: a.getMonth is not a functiond @ skuid__SkuidJS:25(anonymous function) @ VM10115:2InjectedScript._evaluateOn @ VM9895:883InjectedScript._evaluateAndWrap @ VM9895:816InjectedScript.evaluate @ VM9895:682
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
skuid.time.parseSFDate is the function you want.  It takes a Salesforce Formatted date and returns a Javascript date object.  skuid.time.getSFDate takes a Javascript date object and converts it to a Salesforce formatted date string.