Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Drupal 7 English and Chinese
English can get request rate.
Chinese error "Ship Date is invalid. Use format dd-mmm-yyyy"
change uc_usps.module
line:463
'' . format_date(time(), 'custom', 'd-M-Y', 'America/New_York') . '';
to
'' . format_date(time(), 'custom', 'd-m-Y', 'America/New_York') . '';
it works both English and Chinese.
but don't know why. anyone could tell me why and should I change it on uc_usps.module.
Comment | File | Size | Author |
---|---|---|---|
#2 | usps_error.jpg | 46.51 KB | geduozhao |
Comments
Comment #1
TR CreditAttribution: TR commentedPlease turn on the shipping quotes debug information at admin/store/settings/quotes/settings, try to get a quote, and post here the part of the XML sent to USPS that contains the <ShipDate> tag. Do this before and after you make the above change, so we can see what is being sent to USPS by your server.
Comment #2
geduozhao CreditAttribution: geduozhao commentedThank you for your help, TR.
=====================================================
with
('' . format_date(time(), 'custom', 'd-m-Y', 'America/New_York') . '';)
=====================================================
with
('' . format_date(time(), 'custom', 'd-M-Y', 'America/New_York') . '';)
I don't want to hack the uc_usps.module to make it works.Thanks Tim
Comment #3
TR CreditAttribution: TR commentedWhen you post in this forum you have to put markup between <code></code> tags so it's readable.
d-M-Y means to print out the three letter month abbreviation where the M is.
d-m-Y means to print out the two digit month number where the m is.
The USPS documentation says that the three letter month abbreviation, in English, must be used.
It looks like when you use M, you're getting garbage. I suspect that has something to do with how your PHP is configured on your server - maybe your PHP language settings are causing that. You can write a tiny PHP script and run it from the command line to see what that format_date() function prints out on your server.
Comment #4
geduozhao CreditAttribution: geduozhao commentedThanks Tim. Let me try.:)
Comment #5
geduozhao CreditAttribution: geduozhao commentedJust disabled translate d-M-Y to Chinese. It works without hack uc_usps.module.
Thank you so much. Tim.:)
Comment #6
geduozhao CreditAttribution: geduozhao commentedFixed
Comment #7
TR CreditAttribution: TR commentedComment #8
longwaveThis is a bug. format_date() is a Drupal function that by default formats the month name to the current locale (in this case, Chinese) but USPS always expects the month name in English.
Comment #9
longwaveTested on a site with English and French installed, the same error occurs when using French at checkout. Fixed in http://drupalcode.org/project/ubercart.git/commitdiff/fef42ba