You can find the latest version on http://die-katrin.eu/timeconverter.
The idea for this time converter was inspired by a tweet by Wes Bos. I took on this idea as a way to practice creating a little react app, playing with dates× and test some things from my learnings wish list (such as different CSS options for a React app, accessibility and tests).
Wes Bos also mentioned a feature wishlist, which I'll pick up and try to realize over time:
- S and MS Timestamp to Date
- Date Picker to S and MS timestamp
- Ability to pick timezone
- Display current, live timestamp
- Ability to add time. eg: Now + 3 Hours
- Readable dates for everything
This project was bootstrapped with Create React App. You can find many helpful information on their Github repo.
I'm using it as is. This means, Webpack comes out of the box and is not ejected. For this little app, tweaking performance is not my priority.
I've added these node packages for functionality:
If you want to develop locally, follow these steps:
- Fork this repo.
- In your terminal, go to the desired directory and type
git clone <clone-link from github>
. cd time-converter
.- Start the app by running
npm start
.
My web hoster is offering an Apache server. The out-of-the-box create-react-app is rendered on the client side. Thus it is possible to run the npm build command and upload (copy&paste) the files to my web space.
I've uploaded the app to a subdirectory. Therefor I added this line to the package.json
:
"homepage": ".",
This sets the %PUBLIC_URL%
path relative to the index.html. Should I ever want to change the directory or URL for this app, I can do so on my server without the need to re-build this app.
When deploying (in my case this is a fancy word for uploading the build output) to my Apache server, I created an .htaccess
file in the public folder of the app and pasted these lines:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
At last, create the production ready app:
- Run
npm run build
in the terminal. - Go to the FTP client and upload the content of the build folder.
- Remove
.DS_Store
files.
You can find all these and many more information for other use cases and server options in the Deployment section of the create-react-app's Readme.