Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • @atmahana

    Submitted

    Hello fellow Frontend devs!

    It's been a while since my last challenge. So here is my latest work. Built with vanilla CSS, JavaScript and Vite.

    For this particular project, the main obstacle I did encountered is creating the input validation. I didn't really had the idea on how to validate both the input along with checking whether the date entered by user is valid to be calculated. So what did I wrote for the validations?

    Well firstly the application will check whether the user has entered all the required fields. If they failed to do so, it will show a required field error message.

    if (inputValue.length === 0) { errorText.innerHTML = "This field is required"; }

    Next is the date validation. On the date validation, I wrote a function that return the error status of each of the date input as an object.

    function dateIsValid(..params){
    let isError = {
    dayHasError: false,
    monthHasError: false,
    yearHasError: false,
    };
    
    // validating...
    
    return { isError }
    }
    
    

    So on the main application file, I can just called the returned value like this: const { isError } = dateIsValid(..params);

    To access the value of each date input: isError.dayHasError | isError.monthHasError | isError.yearHasError

    Check out the project repository here for the full code.

    Feedbacks are welcome :D

    @ngugimuchangi

    Posted

    Hey Zubair.

    Great work on the application.

    I have a few suggestions that might help you with validation:

    1. Check out the JustValidate library, it helps work on input validation in a much easier and more organized way.
    2. Also HTML offers pattern matching and other input attributes such as min, max, and required. You can use checkValidity() instance method of HTML input elements to check if the input fields, and CSS pseudoselectors such as :invalid and :valid to adjust styling for input fields based on validity.

    JustValidate is an easier route. I hope this helps. Cheers!

    Marked as helpful

    1
  • SudodoSu 210

    @SudodoSu

    Submitted

    • Accurate Age Calculation: The app provides precise age calculations in years, months, weeks, and days.
    • Age Difference Calculation: Users can also calculate the age difference between two dates.
    • Responsive Design: The app is built with a responsive layout, ensuring optimal user experience across devices.
    • Error Handling: Proper validation is in place to handle invalid inputs and provide meaningful error messages.
    • Clean and Intuitive UI: The user interface is designed to be clean, intuitive, and easy to navigate.
    • HTML
    • CSS
    • JavaScript

    This challenge has been a great learning experience for me. It allowed me to further develop my frontend skills and practice working with form inputs, user interactions, and data calculations. I also gained experience in handling errors and providing clear feedback to users.

    I thoroughly enjoyed working on this project, and I am proud of the end result. It was a valuable opportunity to apply my knowledge and improve my coding abilities.

    • Strengthened HTML, CSS, and JavaScript skills
    • Improved form handling and validation techniques
    • Enhanced understanding of responsive design principles
    • Developed error handling and feedback implementation

    Feedback and suggestions for improvement are always welcome.

    Thank you for taking the time to review my submission!

    @ngugimuchangi

    Posted

    @SudodoSu Great solution. The age calculation is quite precise. You can improve on date validation when the year of birth is the same as the current year but the month or day is beyond the current date, i.e., the date is in the future. For instance:

    • 01 July 2023 should return an error, or
    • 05 June 2023 should also return an error.

    I hope this helps. Happy coding.

    Marked as helpful

    0