Problem with date format on international orders

Blackguard's picture
Offline
Joined: 10/24/2007
Juice: 47
Problem with date format on international orders

The following code around line 288 creates invalid dates in some instances when a string describing a delay (1 to 2 months, 2 to 4 weeks) is returned by the canadapost server instead of the expected date format. This happens with overseas surface shipping.

<?php
         
// add est. delivery date
         
if ($datefmt && isset($product->deliverydate[0]) && ($deliverydate = $product->deliverydate[0]->data())) {
           
$deliverydate = strtotime($deliverydate);
           
$rates[$id]['option_label'] .= ' ('. t("Estimated delivery") .': '. date($datefmt, $deliverydate) .')';
?>

When date() is executed with the inappropriate data, the result is 1969/12/31.

The quick fix is to remove date formatting options, but that's not great.

I am also under the impression that in some instances the data returned by the server is buggy. Right now the sellonline team is busy with a software update, but I'll get back to this one when they get back to me.

Canada Post Shipping By: TR (87 replies) Fri, 10/19/2007 - 00:42