// ==UserScript== // @name Instagram absolute date // @namespace http://mrob.com/time/scripts-beta/ // @version 20250131 // @description Show "explicit" (absolute) date on instagram image/post pages // @author Lorenzo Breda and Robert Munafo // @match https://*.instagram.com/* // @grant none // ==/UserScript== function modifyTimestring() { var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]; // not used var elems_date = document.getElementsByTagName("time"); Array.prototype.forEach.call(elems_date, function(item, index) { var date = new Date(item.getAttribute('datetime')); // item.textContent = date.toLocaleString(getLang(), // {day: 'numeric', month: 'short', year: 'numeric', // hour: 'numeric', minute: '2-digit'}); item.textContent = date.toLocaleString('sv-SE'); // to force a specific timezone: // date.toLocaleString('sv-SE', {timeZone: 'America/New_York'}) }); } function getLang() { if (navigator.languages !== undefined){ return navigator.languages[0]; } else { return navigator.language; } } (function() { 'use strict'; modifyTimestring(); var observer = new window.MutationObserver(function(mutations) { if(mutations.length){ modifyTimestring(); Array.from(document.getElementsByTagName("time")).forEach(function(element) { observer.observe(element, {characterData: true, attributes: true}); }); } }); if(document.querySelector('main > section > div > div')){ observer.observe(document.querySelector('main > section > div > div'), {childList: true}); } observer.observe(document.body, {childList: true}); // console.info("document.body should be filled now"); Array.from(document.getElementsByTagName("time")).forEach(function(element) { observer.observe(element, {characterData: true, attributes: true}); }); })();