shift-org / shift-docs

Shift2Bikes: website and calendar for shift and pedalpalooza
https://shift2bikes.org
Other
22 stars 17 forks source link

add "forceCurrentTime" option for dayjs #742

Closed ionous closed 4 months ago

ionous commented 5 months ago

this allows a developer to override the current date and time on the front end for testing. in site config.toml set "forceCurrentTime" to something useful. for example:

[params]
forceCurrentTime =  "06-13-2024 23:00"

as a safety, it only works when building drafts. preview deploys use drafts, but production does not. re: https://github.com/shift-org/shift-docs/blob/main/netlify.toml

[context.deploy-preview]
  # this command builds draft content for deploy previews
  command = 'hugo -D && cp public/404/index.html public/404.html'

[context.production]
  # Note that there are two versions of the below command 
  # drafts are excluded (no `-D` option to hugo) for prod build. 
  command = 'hugo ...