tuanphan Posted March 25, 2023 Share Posted March 25, 2023 On 3/21/2023 at 10:24 PM, johnpaulstuthridge said: https://www.manfortoday.com/ Password: mft1996 Which code did you add? Can you take a screenshot of your Code Injection? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
johnpaulstuthridge Posted March 26, 2023 Share Posted March 26, 2023 On 3/25/2023 at 7:56 AM, tuanphan said: Which code did you add? Can you take a screenshot of your Code Injection? You can see where I've injected the code and changed the date format accordingly, but the meta data date format on the blog collection page still won't change. Link to comment
Miratus Posted April 3, 2023 Share Posted April 3, 2023 Great solution, many thanks to StevenLevithan code snippet! Link to comment
sharine Posted April 17, 2023 Share Posted April 17, 2023 Hey everyone, I've repurposed a blog into a job board and want to know if instead of just the date appearing, it can be prefaced with 'Applications Close'. When I publish the blog post/job opportunity, the publish date would be in the future, so together it would read 'Applications Close [DATE]. Thanks! Link to comment
tuanphan Posted April 19, 2023 Share Posted April 19, 2023 On 4/17/2023 at 10:03 PM, sharine said: Hey everyone, I've repurposed a blog into a job board and want to know if instead of just the date appearing, it can be prefaced with 'Applications Close'. When I publish the blog post/job opportunity, the publish date would be in the future, so together it would read 'Applications Close [DATE]. Thanks! Can you share link to a blog? I guess we can use CSS pseudo to add a text before the date Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
sharine Posted April 21, 2023 Share Posted April 21, 2023 @tuanphan I was able to figure it out, thanks so much! Link to comment
dwinnbrown Posted May 1, 2023 Share Posted May 1, 2023 @Beyondspace Did you ever manage to work out a solution to the date offset issue? I've got a site here: https://www.isscr.org/isscr-news/the-power-of-partnership which seems to be 1 day off on some posts - apart from that everything's working perfectly! Official Squarespace Expert | Founder @ Winn-Brown & Co. 👉 Get in Touch 📍 London, UK Link to comment
dwinnbrown Posted May 16, 2023 Share Posted May 16, 2023 In case anyone is looking for the solution to this, I was able to fix the 'one day off' issue by changing the variable from (removing the split on the 'T') : d = new Date(document.querySelector('[itemprop="datePublished"]').getAttribute("content").split("T")[0]); to: d = new Date(document.querySelector('[itemprop="datePublished"]').getAttribute("content")); Official Squarespace Expert | Founder @ Winn-Brown & Co. 👉 Get in Touch 📍 London, UK Link to comment
Beyondspace Posted May 16, 2023 Share Posted May 16, 2023 (edited) Nit: The script you are using has been upgraded, check The script will get the exact date value from timestamp and convert it into your website's timezone so it seems to be working now Edited May 16, 2023 by Beyondspace BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
Ryan124 Posted July 11, 2023 Share Posted July 11, 2023 Hey guys, code for re-formatting date works wonderfully. I have run into the issue of the date on my blog collection grid being different from the actual publish date. See attached. Any work-arounds for this? Thanks! Link to comment
perhapsmybe Posted July 19, 2023 Share Posted July 19, 2023 (edited) On 3/25/2021 at 10:01 AM, Beyondspace said: 🌍 [16-May-2023] Update The scirpt has been updated to fix some known issues, the details can be found in the post below Live editor also available on Beyondspace.studio 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ Update the placement using css .blog-basic-grid--text { display: flex; flex-wrap: wrap; } .blog-basic-grid--text .blog-more-link { width: 100%; } .blog-basic-grid--text .blog-meta-section { order: 9; } Update the dateformat using custom code Please add this snippet into Settings->Advanced->Code Injection to format the date the way you like it <!-- Fix inconsistent blog date format on Squarespace 7.1 template --> <!-- Squarespace Forum 03-08-2021 --> <script src="https://stevenlevithan.com/assets/misc/date.format.js"></script> <script> document.addEventListener('DOMContentLoaded', function() { var dateformat = "mm-dd-yyyy"; var pubdate = document.querySelectorAll("time[datetime], time[pubdate], time.blog-meta-item--date"); for (var i = 0; i < pubdate.length; i++) { var d = new Date(pubdate[i].getAttribute("datetime") || pubdate[i].innerText); if ( pubdate[i].classList.contains('blog-meta-item--date') ) { d = new Date(document.querySelector('[itemprop="datePublished"]').getAttribute("content").split("T")[0]); } pubdate[i].innerHTML = d.format(dateformat); } }); </script> The variable dateformat currently set with "mm-dd-yyyy", but you can change to different format (reference here) These are some more format that supported: "mm-dd-yyyy" --> 02-25-2021 "dd-mm-yyyy" --> 25-02-2021 "mm/dd/yyyy" --> 02/25/2021 "mmm dd yyyy" --> Feb/25/2021 Hello.. I tried using this code but it didn't work. Maybe because I have a code injection of: <style> .blog-meta-item--tags { display: none; } </style> I tried putting it on the top and inside of <style> and</style> but it didn't work so I just deleted it. Is there any workaround for that? Website Post Sample: https://perhapsmybe.com/post/drowning UPDATE: Solution found here: Edited July 19, 2023 by perhapsmybe tuanphan 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment