Buy me a coffee

How to add Year to Published Date

To add Year to Blog Published Date, you can do these
#1. Use this code to Code Injection > Footer

<!-- Fix inconsistent blog date format on Squarespace 7.1 template -->
<!-- Squarespace Forum Update 06-11-2021 -->
<script src="https://stevenlevithan.com/assets/misc/date.format.js"></script>
<script>
        (function(){
        document.addEventListener('DOMContentLoaded', function() {
            const dateformat = "mm-dd-yyyy";
            const pubdates = document.querySelectorAll("time[datetime]:not([class*=event-time]), time[pubdate], time.blog-meta-item--date");
            pubdates.forEach(pubDate => {
                let d = new Date(pubDate.getAttribute("datetime") || pubDate.innerText);
                if (pubDate.classList.contains('blog-meta-item--date') ) {
                    d = new Date(document.querySelector('[itemprop="datePublished"]').getAttribute('content').split("T")[0]);
                }
                pubDate.innerHTML = d.format(dateformat); 
            });
        });
    })();
</script>

5c44a9c445e3e2bdbbf2 Min

#2. Result
Blog List Page

23152b18c73f6061392e Min

Blog Posts

286f9e137234d56a8c25 Min