Skip to content

Display current date instead of “Today” + prevent adding empty tasks #2

@notriyaverma

Description

@notriyaverma
  • ** Currently, the to-do list app shows a static title “Today” on the top of the page.
    It would be more dynamic and user-friendly if it displayed the current date (e.g., “Thursday, November 6”) automatically.

  • Additionally, the app currently allows adding empty tasks, which results in blank entries in the list.
    A validation check (both front-end and back-end) should prevent this and show a small popup or message like “⚠️ Empty task!” when users attempt to add an empty input.**

Expected Behavior:

  1. The header dynamically shows the current date.

  2. When the add (+) button is clicked with an empty input:
    No new task is added.
    A popup or small message appears saying “Empty task!”.

Current Behavior:

The header always displays “Today”, regardless of the actual date.
Clicking the add (+) button with an empty field still adds a blank task to the list.

Proposed Solution:

  • Modify the Express route to pass the formatted current date to the EJS template.

  • Add front-end validation (JavaScript) to block submission of empty inputs.

  • Add a small error message element under the input box for user feedback.

  • Optionally add a server-side check to ensure data integrity.

Files to be Modified:

app.js

views/list.ejs

> This enhancement improves user experience and prevents invalid data from being added to the database. I’d love to work on this issue as my first open-source contribution. 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions