Skip to content

Instantly share code, notes, and snippets.

@Tauka
Created February 11, 2020 06:41
Show Gist options
  • Save Tauka/2ced9d2d9a489d3000783dc084d0e0af to your computer and use it in GitHub Desktop.
Save Tauka/2ced9d2d9a489d3000783dc084d0e0af to your computer and use it in GitHub Desktop.
Script that writes today's date in .env file
const fs = require('fs');
const path = require('path');
const today = new Date();
const dd = String(today.getDate()).padStart(2, '0');
const mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
const yyyy = today.getFullYear();
const dateString = `${dd}.${mm}.${yyyy}`;
fs.writeFileSync(path.join(__dirname, '.env'), `VERSION=${dateString}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment