My train schedule tool, integrated with Firebase and coded in JavaScript.
When submitting a new train to the schedule, the submit function will trigger the following:
- Trim all submission values
- Check for any empty values
- Check if the entered time is in 24 hour format
- Push verified submission to the database
- Empty the input form
Any new child added to the database triggers another function:
- Calculates next train arrival and minutes to arrival with Moment.js
- Creates new row elements
- Appends the train information to the elements
- Appends the row to the table
The page must be refreshed to keep "Next Arrival" and "Minutes Away" values up to date. The submission form also includes a clear function.