Skip to content

nafri97/age-calculator

Repository files navigation

Frontend Mentor - Age calculator app solution

This is a solution to the Age calculator app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Note: Delete this note and update the table of contents based on what sections you keep.

Overview

The challenge

Users should be able to:

  • View an age in years, months, and days after submitting a valid date through the form
  • Receive validation errors if:
    • Any field is empty when the form is submitted
    • The day number is not between 1-31
    • The month number is not between 1-12
    • The year is in the future
    • The date is invalid e.g. 31/04/1991 (there are 30 days in April)
  • View the optimal layout for the interface depending on their device's screen size
  • See hover and focus states for all interactive elements on the page
  • Bonus: See the age numbers animate to their final number when the form is submitted

Screenshot

Desktop Mobile

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • Javascript
  • Vue.js - JS library
  • vite.js - Help me to build my vue app
  • Tailwind CSS - For styles

Note: These are just examples. Delete this note and replace the list above with your own choices

What I learned

Use this section to recap over some of your major learnings while working through this project. Writing these out and providing code samples of areas you want to highlight is a great way to reinforce your own knowledge.

To see how you can add code snippets, see below:

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
  .label {
    @apply uppercase font-bold text-base tracking-widest;
  }

  .input {
    @apply border-solid border-2 rounded-lg py-2 md:py-4 pl-3 md:pl-6 font-black w-16 md:w-40 focus:outline-none
  }
}
  data(){
    return{
      currentDate: new Date().toLocaleDateString(),
      currentDay : new Date().getDate(),
      currentMonth : new Date().getMonth() + 1, //getMonth strart in 0
      currentYear : new Date().getFullYear(),
    }
  },
  components: {
    copyright,
  },
  computed: {
    day() {
      //
    }

Continued development

I will learn more about Javascript and its Library especially vue.js, and in the future I will learn Typescript.

Useful resources

  • w3school -the most complete Documentation.
  • ChatGPT - My Reliable assistant :D.

Author

-Linkedin - [Irfan Rizki Saputra] (http://linkedin.com//in/nafri97)

Acknowledgments

This is where you can give a hat tip to anyone who helped you out on this project. Perhaps you worked in a team or got some inspiration from someone else's solution. This is the perfect place to give them some credit.

========================================================================

age-calculator

This template should help get you started developing with Vue 3 in Vite.

Recommended IDE Setup

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

npm run dev

Compile and Minify for Production

npm run build