Skip to content

Instantly share code, notes, and snippets.

@froboy
Last active March 13, 2020 22:05
Show Gist options
  • Save froboy/0fa764ccae683a2a97630f777e694b03 to your computer and use it in GitHub Desktop.
Save froboy/0fa764ccae683a2a97630f777e694b03 to your computer and use it in GitHub Desktop.
Changing dates on your docksal-powered VM to test date-dependent functionality.
###
# For docksal via VirtualBox:
###
# Check the date in the VM
fin vm ssh date
# Check the date in the CLI container
fin exec date
# Check the time on your host
date
# These should match to start.
# Change the date in the VM
# Accepts a number of time formats. You can set just the time or just the date if you like.
# https://busybox.net/downloads/BusyBox.html#date
fin vm ssh sudo date --set 2020-04-01
# Print your host date and the CLI date to see that they're now different.
date && fin exec date
# Now any date logic in your application should behave as if it's the past or the future!
# Let's get back to normal. via https://stackoverflow.com/a/50730524/2566038
fin vm ssh sudo ntpd -q
# Alternately, just ReBoot!
fin vm restart && fin start
###
# For docksal inside an Ubuntu VM. via https://askubuntu.com/a/331871
###
# Open Windows Powershell or cmd
"C:\Program Files\Oracle\VirtualBox\VBoxManage" setextradata "Your VM Name" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1
# Restart the VM, then go into system settings, disable automatic date setting, and set the new date...
# Or open a terminal and set the date
sudo date --set 2020-04-01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment