How to Set Date Time from Mac Command Line
Working on a web extension that ships to an app store and isn't immediately modifiable, like a website, can be difficult. Since you cannot immediately deploy updates, you sometimes need to bake in hardcoded date-based logic. Testing future dates can be difficult if you don't know how to quickly change the date on your local machine.
To change the current date on your Mac, execute the following from command line:
# Date Format: MMDDYYYY
sudo date -I 06142024
This command does not modify time, only the current date. Using the same command to reset to current date is easy as well!
For maximum performance, we all know we must put our assets on CDN (another domain). Along with those assets are custom web fonts. Unfortunately custom web fonts via CDN (or any cross-domain font request) don't work in Firefox or Internet Explorer (correctly so, by spec) though...
Introduction
For quite a long time now websites with the so called "parallax" effect have been really popular.
In case you have not heard of this effect, it basically includes different layers of images that are moving in different directions or with different speed. This leads to a...
It's something that makes all men live in fear, and are often uncertain of. It's never spoken, but the curiosity is always there. Nine out of ten women agree in the affirmative. Advertisers do their best to make us feel inadequate but...
CSS filter support recently landed within WebKit nightlies. CSS filters provide a method for modifying the rendering of a basic DOM element, image, or video. CSS filters allow for blurring, warping, and modifying the color intensity of elements. Let's have...
I didn’t understand your exact use case, but a helpful way to do date-related testing without modifying your actual computer date/time, is to shim the system calls with library pre-loading. On a Mac, dyld can do this with DYLD_LIBRARY_PATH. On Linux, GNU ld can do it with LD_LIBRARY_PATH.
This makes it easy to write tests for specific situations, such as monthly changeovers, leap-occurrences, timezones, etc.
“libfaketime” is a handy library written for this, https://github.com/wolfcw/libfaketime. It’s even packaged in homebrew, just do
brew install libfaketime
. :)