function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
unikevinunikevin 

Salesforce's Ajax toolkits' datetimetostring bug

 
Hi ,
 
I monitor the ajax toolkits' soap data in my S-Control :
 
<se:Header xmlns:sfns="urn:partner.soap.sforce.com">
<sfns:SessionHeader>
<sessionId>WvLpEofU4BNRHwInYctpjx5OXhi9LLHWoDt7HrgFFT1YHnpvXnFwx.__xhFEmSoz.ByHtgAcUspGg3YgLWd.l.M5Yn1._1Hp1r_cVphWHeu3fM5vZFImbnTruOHNFS6Ldp4QxgCU</sessionId>
</sfns:SessionHeader></se:Header>
<se:Body>
<create xmlns="urn:partner.soap.sforce.com" xmlns:ns1="sobject.partner.soap.sforce.com">
<ns1:sObjects>
<type>CallRecord__c</type>
<MonthlyPlanDetail__c>a0S20000000FvLSEA0</MonthlyPlanDetail__c>
<Account__c>00120000004Mqp6AAC</Account__c>
<Contact__c>00320000006WrhKAAS</Contact__c>
<MonthlyPlan__c>a0R200000004Uk4EAE</MonthlyPlan__c>
<fieldsToNull>ContactInfoByUser__c</fieldsToNull>
<StartTime__c>2007-09-06T07:49:00-16:00</StartTime__c>
<EndTime__c>2007-09-06T08:49:00+08:00</EndTime__c>
</ns1:sObjects></create>
</se:Body>
</se:Envelope>
 
Please notice the red words above: "2007-09-06T07:49:00-16:00", the timezone becomes -16:00! but actually the value is "2007-09-06T07:49:00+08:00".
 
In the "https://emea.salesforce.com/soap/ajax/9.0/connection.js"  or "/10.0/connection.js"  file, I find a function "sforce.internal.dateTimeToString()" , it changed my timezone from +08:00 to -16:00 when the hour is less than 8:00 , I think there is a bug .
 
here are some sample codes:
 
new Date(2007,8,10,7,30,0) //  Mon Sep 10 07:30:00 UTC+0800 2007 . it's right 
 
sforce.internal.dateTimeToString( new Date(2007,8,10,7,30,0) ) // it becomes 2007-09-10T07:30:00-16:00 . it's wrong.
 
 
anyone can help?
 
thanks!
 
sfdcfoxsfdcfox
unikevin,
 
Could you edit your message (above), and post your code using the SRC button, please? It's hard to help you when I can't read the code correctly, and it screws up my page something fierce. I'd be glad to try and help if you you'd just fix your post so I can read it.
 
~ sfdcfox ~
unikevinunikevin
Okey..
 
Code:
<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/">
<se:Header xmlns:sfns="urn:partner.soap.sforce.com">
<sfns:SessionHeader>
<sessionId>WvLpEofU4BNRHwInYctpjx5OXhi9LLHWoDt7HrgFFT1YHnpvXnFwx.__xhFEmSoz.ByHtgAcUspGg3YgLWd.l.M5Yn1._1Hp1r_cVphWHeu3fM5vZFImbnTruOHNFS6Ldp4QxgCU</sessionId>
</sfns:SessionHeader></se:Header>
<se:Body>
<create xmlns="urn:partner.soap.sforce.com" xmlns:ns1="sobject.partner.soap.sforce.com">
<ns1:sObjects>
<type>CallRecord__c</type>
<MonthlyPlanDetail__c>a0S20000000FvLSEA0</MonthlyPlanDetail__c>
<Account__c>00120000004Mqp6AAC</Account__c>
<Contact__c>00320000006WrhKAAS</Contact__c>
<MonthlyPlan__c>a0R200000004Uk4EAE</MonthlyPlan__c>
<fieldsToNull>ContactInfoByUser__c</fieldsToNull>
<StartTime__c>2007-09-06T07:49:00-16:00</StartTime__c>
<EndTime__c>2007-09-06T08:49:00+08:00</EndTime__c>
<CallType__c></CallType__c><CallScheme__c></CallScheme__c><plannedOrUnplanned__c>计åˆ'</plannedOrUnplanned__c>
</ns1:sObjects></create>
</se:Body>
</se:Envelope>
 
Please notice the red words above: "2007-09-06T07:49:00-16:00", the timezone becomes -16:00! but actually the value is "2007-09-06T07:49:00+08:00". 
 
In the "https://emea.salesforce.com/soap/ajax/9.0/connection.js" file, I find a function "sforce.internal.dateTimeToString ()" , it changed my timezone from +08:00 to -16:00 when the hour is less than 8:00 , I think it is a bug .
 
here are some sample codes:
 
new Date(2007,8,10,7,30,0) //  Mon Sep 10 07:30:00 UTC+0800 2007, it's right
 
sforce.internal.dateTimeToString( new Date(2007,8,10,7,30,0) ) // it becomes 2007-09-10T07:30:00-16:00, it's wrong!