Skip to content

Instantly share code, notes, and snippets.

@binarycraft007
Created August 24, 2026 08:26
Show Gist options
  • Select an option

  • Save binarycraft007/cf205859da38811915cdcf3493c99f1a to your computer and use it in GitHub Desktop.

Select an option

Save binarycraft007/cf205859da38811915cdcf3493c99f1a to your computer and use it in GitHub Desktop.
A Tampermonkey user script to spoof year 2038
// ==UserScript==
// @name Spoof Year 2038
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Makes the browser think it's 2038
// @match *://*/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Set target date to January 19, 2038 (or any date you prefer)
const targetDate = new Date("2038-01-19T03:14:07Z").getTime();
const realDate = Date.now();
const offset = targetDate - realDate;
const OriginalDate = Date;
function SpoofedDate(...args) {
// If called with no arguments (e.g., new Date()), return the spoofed time
if (args.length === 0) {
return new OriginalDate(OriginalDate.now() + offset);
}
// If called without 'new' (e.g., Date()), return string representation of spoofed time
if (!new.target) {
return new OriginalDate(OriginalDate.now() + offset).toString();
}
// Otherwise, behave normally
return new OriginalDate(...args);
}
// Override Date.now()
SpoofedDate.now = function() {
return OriginalDate.now() + offset;
};
// Maintain original static methods and prototype
SpoofedDate.parse = OriginalDate.parse;
SpoofedDate.UTC = OriginalDate.UTC;
SpoofedDate.prototype = OriginalDate.prototype;
// Replace the global Date object
window.Date = SpoofedDate;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment