Edit Date in Receipt

General ShopSite user discussion
Post Reply
silken
Posts: 120
Joined: Mon Jun 07, 2010 11:56 am
Location: santa cruz, ca

Edit Date in Receipt

Post by silken »

This is a small issue, but how do I edit the way the date is displayed in the order receipt? Right now it looks like this:

Order Date: Thu Feb 11 09:20:59 2016

And it is annoying to have the time interrupting the flow of the date itself. I would like to put the time before or after the date.

Thanks!
Debbie
ShopSite Lauren
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT
Contact:

Re: Edit Date in Receipt

Post by ShopSite Lauren »

Debbie, this isn't an option in ShopSite. However, you could add custom javascript to move or change the time. I have two examples of javascript below that you could use, one for the view order screen and one for the packing slip screen (if you are using the PackingSlip.sst template, if you are using the PackingSlipBasic.sst template, the first javascript should work for both screens). The javascript below also changes the military time display to a basic 12-hour time display.

The javascript examples below change the display from:
Mon Oct 03 15:58:34 2016
To:
Mon Oct 03 2016 @ 3:58pm

Code for Orders > Configure Orders > View Order Footer:

Code: Select all

<script type="text/javascript">
var datefield = document.getElementsByClassName("order_date om")[0].innerHTML;
var twelvetimehour = datefield.substr(30,2);
var twelvetimehalf = "am";
if (twelvetimehour > 11) {var twelvetimehalf = "pm"; if (twelvetimehour > 12) {twelvetimehour = parseInt(twelvetimehour) - 12}};
document.getElementsByClassName("order_date om")[0].innerHTML = datefield.replace((datefield.substr(30,9)), "") + " @ " + twelvetimehour + ":"+ datefield.substr(33,2) + twelvetimehalf;
</script>
Code for Orders > Configure Orders > Packing Slip Footer:

Code: Select all

<script type="text/javascript">
var datefield = document.getElementById("om-date").innerHTML;
var twelvetimehour = datefield.substr(30,2);
var twelvetimehalf = "am";
if (twelvetimehour > 11) {var twelvetimehalf = "pm"; if (twelvetimehour > 12) {twelvetimehour = parseInt(twelvetimehour) - 12}};
document.getElementById("om-date").innerHTML = datefield.replace((datefield.substr(30,9)), "") + " @ " + twelvetimehour + ":"+ datefield.substr(33,2) + twelvetimehalf;
</script>
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
silken
Posts: 120
Joined: Mon Jun 07, 2010 11:56 am
Location: santa cruz, ca

Re: Edit Date in Receipt

Post by silken »

Brilliant! 100% works and incredibly easy to do. Can't thank you enough.
Best,
Debbie
Post Reply