Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello,
I want to display estimated delivery dates to my costumers in Shopify.
I found this great article and implemented their code as described.: https://www.identixweb.com/how-to-display-estimated-delivery-date-and-time-on-your-shopify-store/
The code is:
<p> <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
Get it between <strong><span id="fromDate"></span> - <span id="toDate"></span></strong></p>
{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
var fromDate = Date.today().addDays(5);
if (fromDate.is().saturday() || fromDate.is().sunday()) {
fromDate = fromDate.next().monday();
}
var toDate = Date.today().addDays(10);
if (toDate.is().saturday() || toDate.is().sunday()) {
toDate = toDate.next().monday();
}
document.getElementById('fromDate').innerHTML = fromDate.toString('dddd MMMM dS');
document.getElementById('toDate').innerHTML = toDate.toString('dddd MMMM dS');
</script>
The problem with it: It displays the date in English.
I can change the "Get it between" part, no problem.
But the dates and formatting is pulled from a database that is English as far as I know.
Does anyone have an idea how to change the database to a German one?
Help would be greatly appreciated!
Kind regards
Thea
Solved! Go to the solution
This is an accepted solution.
Solved the problem myself,
for anyone interested:
<p> <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
Lieferung zwischen <strong><span id="fromDate"></span> und <span id="toDate"></span></strong> bei Bestellungen heute bis 14.00 Uhr </p>
{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
var fromDate = Date.today().addDays(1);
if (fromDate.is().saturday() || fromDate.is().sunday()) {
fromDate = fromDate.next().monday();
}
var toDate = Date.today().addDays(3);
if (toDate.is().sunday()) {
toDate = toDate.next().monday();
}
let options = { weekday: 'short', month: 'long', day: 'numeric' };
document.getElementById('fromDate').innerHTML = fromDate.toLocaleString('de-DE',options);
document.getElementById('toDate').innerHTML = toDate.toLocaleString('de-DE',options);
</script>
This is an accepted solution.
Solved the problem myself,
for anyone interested:
<p> <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
Lieferung zwischen <strong><span id="fromDate"></span> und <span id="toDate"></span></strong> bei Bestellungen heute bis 14.00 Uhr </p>
{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
var fromDate = Date.today().addDays(1);
if (fromDate.is().saturday() || fromDate.is().sunday()) {
fromDate = fromDate.next().monday();
}
var toDate = Date.today().addDays(3);
if (toDate.is().sunday()) {
toDate = toDate.next().monday();
}
let options = { weekday: 'short', month: 'long', day: 'numeric' };
document.getElementById('fromDate').innerHTML = fromDate.toLocaleString('de-DE',options);
document.getElementById('toDate').innerHTML = toDate.toLocaleString('de-DE',options);
</script>
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025