How To Build Age Calculator App Using HTML CSS And JavaScript

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 132

  • @islamicfinance001
    @islamicfinance001 10 місяців тому +41

    For those like me who did not understand the JS code of line 22:
    Here's a step-by-step breakdown:
    1. new Date().toISOString(): new Date() creates a new JavaScript Date object representing the current date and time.
    .toISOString() converts the Date object to a string in ISO format, which looks like this: "YYYY-MM-DDTHH:mm:ss.sssZ". This format includes the date, time, and timezone information.
    2. .split("T"): .split("T") is a method that splits the string into an array of substrings using the "T" character as the separator. After the split, you get an array with two elements: the date part before "T" and the time part after "T".
    3. [0]: [0] retrieves the first element of the array, which is the date part.
    4. "userInput.max = ...": userInput refers to an HTML input element, likely of type "date".
    The .max attribute sets the maximum allowed value for the date input.
    Putting it all together, the line of code sets the maximum date for the input element to the current date. It extracts the date part from the ISO string format and assigns it to the max attribute. This ensures that users cannot select a date beyond the current date when using the input field. (thanks to chatGPT for the explanation)

  • @Applecitylightkiwi
    @Applecitylightkiwi Рік тому +4

    people always said hey man use date api in js, date methods in js is a headache, now i understand why

  • @anmolyadav7105
    @anmolyadav7105 Рік тому +9

    This types of projects are beneficial for us beginners. Can't thank you enough!

    • @rajbarua7785
      @rajbarua7785 8 місяців тому

      bruh what is your skill level right now???

    • @almudrikal9528
      @almudrikal9528 4 місяці тому

      @@rajbarua7785 why you asking that

  • @CollegeNotes
    @CollegeNotes Рік тому +14

    Hello Mr. Easy Tutorials!
    I really appreciate this project tutorial and all the work you put into it. Huge thanks for your efforts!
    In my implementation I wanted to change the 'days' to 'day' when d3 === 1, and the same with months and years, so I did this slight adjustment creating variables with a ternary operator to pluralise these words whenever the value was not exactly equal to 1:
    let pluralDays = d3 !== 1 ? "days" : "day";
    let pluralMonths = m3 !== 1 ? "months" : "month";
    let pluralYears = y3 !== 1 ? "years" : "year";
    then the template literal was:
    result.innerHTML = `You are ${y3} ${pluralYears}, ${m3} ${pluralMonths} and ${d3} ${pluralDays} old.`;
    Just thought I'd post this here in case anyone else was thinking the same thing!
    Many thanks,
    David

  • @bmscodehub
    @bmscodehub Рік тому +1

    thanks alot for being a life saver of self taught web developer

  • @iftyrahman2239
    @iftyrahman2239 Рік тому +4

    Hello Avinash, Bro next time make a shopping cart tutorial.

  • @ugyenofficial
    @ugyenofficial Рік тому +4

    I cannot leave without thanking you for your free and great resources

  • @shifteditz06
    @shifteditz06 3 місяці тому +3

    Hey guys please help me, : : -webkit-calender-picker-indicator is not working. Displaying small date input in the browser

    • @steff18
      @steff18 2 місяці тому

      .input-box input::-webkit-calendar-picker-indicator
      This is the correct way of spelling it.
      ( calendar is with an 'a' and not an 'e' ) :)

  • @AnkushKumar-px9dp
    @AnkushKumar-px9dp Рік тому +3

    hey bro after creating the webkit in css my date icon shifted to left side.. please help me out

    • @T0BC00N
      @T0BC00N Рік тому +9

      add the spaces around the minus(-) in the background-position line... calc(100% - 10px);

    • @subramanyam681
      @subramanyam681 Місяць тому

      @@T0BC00N Thank you for clearing my doubt too bro

  • @gomeztorricellygomez7808
    @gomeztorricellygomez7808 9 місяців тому

    I nailed it,works like charm to me

  • @Kiran23456
    @Kiran23456 7 місяців тому

    Untill i become boss you are my boss

  • @Papang209
    @Papang209 11 місяців тому

    How about the result will be in the input box?

  • @akanimoekong1817
    @akanimoekong1817 Рік тому +16

    I'm grateful for your lessons, but I have a problem with the WebKit-calender-picker-indicator. It does not seems to be effective on my output. There is no positive response. The should be an indicator of I touch the date on my browser, but nothing changes. please help!

    • @mirzatahataha2467
      @mirzatahataha2467 11 місяців тому +3

      same issue it also looking very small

    • @GGARIN.C.R
      @GGARIN.C.R 6 місяців тому +1

      Bro it may happen due to browser incompatible

    • @OlaRsk
      @OlaRsk 5 місяців тому +1

      Maybe you miss the "-" at the beginning

    • @Mentor_Makhdoom_Shorts
      @Mentor_Makhdoom_Shorts 4 місяці тому +1

      it is -webkit-calendar-picker-indicator check the starting...

    • @manjeet0768
      @manjeet0768 3 місяці тому

      Set type="date"

  • @cart0_0n24
    @cart0_0n24 Рік тому

    everything is great except your explanations ... please explain how syntax are working

  • @physical_information
    @physical_information 6 місяців тому

    very good teching style i like it sir

  • @icyzenax2501
    @icyzenax2501 Рік тому

    Big fan Bro You Are Genious in Your Skills

  • @spsanidhya283
    @spsanidhya283 5 місяців тому

    Thank You that was an easy tutorial.

  • @andystar444
    @andystar444 Рік тому +2

    love the work keep it up boss💯🙏

  • @Wideshorts-
    @Wideshorts- 11 місяців тому

    sir it's displaying 'you are ${y3} years, ${m3} months, ${d3} days old' instead of 3 years, 4months, 3 days old for example.

    • @JessieAstra
      @JessieAstra 9 місяців тому +1

      same here bro. have you seen a solution to that?

    • @Wideshorts-
      @Wideshorts- 9 місяців тому

      @@JessieAstra yes call the function and change the command in printf as your wish to come

    • @vishalrajput8231
      @vishalrajput8231 8 місяців тому +1

      Bro use template literal == `` `` ,
      Ye vale nahi == ' '

    • @DavidMunyagwa
      @DavidMunyagwa Місяць тому

      ​@@Wideshorts-am receiving the same error 😢what can I do

  • @maryamheidari3110
    @maryamheidari3110 Рік тому +1

    Hi thanks for great video
    But my text align is not exactly under the box ,why?

  • @sachinkundu2427
    @sachinkundu2427 Рік тому +1

    Thanks for video can you please upload search functionality with js .. search ..

  • @NinjaPro3
    @NinjaPro3 Рік тому

    UZBEKISTAN , HELLO BROTHER I LOVE YOU

  • @KardanKaaal
    @KardanKaaal 2 місяці тому +1

    Today's date is the 12th of August but it is showing the 11th of August. What to do ?

  • @Z_Rokhri
    @Z_Rokhri Рік тому +3

    What is the reason for not showing my results?

    • @mvb873
      @mvb873 Рік тому

      Same it's showing in the console but not in para

    • @nihalnic
      @nihalnic Рік тому

      I think you are Using ( " ) or( ' ) quota, That's why your code is not working.
      Use (`) this one and see Magic 😂
      Btw sorry for my bad English🙂
      im still learning😁

    • @NoumanEjaz-x3r
      @NoumanEjaz-x3r Рік тому

      mine is not shown even in console
      @@mvb873

  • @Kai-Ming05
    @Kai-Ming05 4 місяці тому

    Bro everything is fine but when i add js then whatever i input in the calendar it shows 0 what to do next please help 🥺

  • @niranjanvanka376
    @niranjanvanka376 Рік тому +1

    Hello sir make javascript tutorial
    Why because in your project we are suffering to understand the js code

  • @MewANtics
    @MewANtics 3 місяці тому

    new Date() is not showing up as a method for me and I have no clue why.

  • @c_h_a_n_dra630
    @c_h_a_n_dra630 Місяць тому

    my calculate button is not working .what should i do?

  • @ARJUN_030
    @ARJUN_030 Рік тому +2

    Big fan anna❤

  • @the_sky_fire
    @the_sky_fire Рік тому +2

    For me the .input-box input::-webkit-calendar-picker-indicator is not working I don' t know why. When I searched it said it depends on browser or something. We need to add additional things for this to work.
    If anyone found this working please reply me back. Thank you in advance

    • @bilalmuneer877
      @bilalmuneer877 Рік тому +2

      Calc (100% - 10px) us mines ka agay or pichy space doo phr sahi ho gy ga

  • @amshovon1125
    @amshovon1125 Рік тому +1

    Hello, I am watching video and try to code run but problem is don't show calculate years, month, days ,, result show 0days, 0month , 0years....How can i solve this problem??? Please help me. Thank you

    • @tahashahid4186
      @tahashahid4186 11 місяців тому

      if you get the solution plz share with me.

    • @ayoubbelmouche8818
      @ayoubbelmouche8818 11 місяців тому

      i think you wroned in "let d2 = today.getDate()" i guess you write "let d2 = birthDate.getDate()" the same case for m2 and y2

  • @harshasharma5103
    @harshasharma5103 Рік тому

    Hello It is not showing anything in console box I have put yr code same but there is nothing

  • @konstantinreut2577
    @konstantinreut2577 11 місяців тому

    Great job, sir!

  • @manjeshsingh3002
    @manjeshsingh3002 11 місяців тому

    Thanks brother 🙏

  • @DavidMunyagwa
    @DavidMunyagwa Місяць тому

    hello everyone, thanks a lot but i have a problem why is that i receive 'You are ${y3} years, ${m3} months and ${d3} days old'; when i try to run the web page Age calculator,

  • @dreamer7084
    @dreamer7084 Рік тому +2

    My calendar button is in the format of mm/dd/yyyy and calculate button also not working. If anybody knows let me know guys.

    • @syedanas4186
      @syedanas4186 Рік тому

      Did you add the onlick function on button?

  • @sanjanasoni1043
    @sanjanasoni1043 4 місяці тому

    Thanku so much for uploading this it's grt 🙏

  • @ShivaMGupta-go1on
    @ShivaMGupta-go1on Рік тому

    my problem is userInput.max its not supported show type error line 23

  • @ichigo23984
    @ichigo23984 Рік тому

    Like the tutorial 💚

  • @vahazbade
    @vahazbade Рік тому

    Like the tutorial 👌

  • @Depstechinsight
    @Depstechinsight 11 місяців тому +1

    Why the js part not working does anyone know

  • @Muhammar_Rabbi
    @Muhammar_Rabbi Рік тому

    you can make video on urdu/hindi language plx

  • @_vickyy
    @_vickyy 6 місяців тому

    Date not showing..

  • @flyflor599
    @flyflor599 Рік тому

    excellent

  • @FloriRosenbaum
    @FloriRosenbaum 9 місяців тому

    it says nan bcause the console.log doesnt wort but i dunt know why

  • @Mohsenkardani
    @Mohsenkardani 10 місяців тому

    thank you

  • @jamesjordon-vq4cw
    @jamesjordon-vq4cw Рік тому

    Keep it up❤

  • @ramyakantipudi4634
    @ramyakantipudi4634 Рік тому

    My result is showing in console but not after adding result.innerHTML. why can you please tell me whats the wrong

    • @monk_widom
      @monk_widom Рік тому

      Me to .... solution?

    • @josefigarola5402
      @josefigarola5402 Рік тому

      In the html file, you have to add the p tag to display the text
      then create the variable result that'll change the output after result.innerHTML
      let result = document.getElementById("result");
      This should work :)

  • @laibaishfaq5564
    @laibaishfaq5564 Рік тому

    thank you sir

  • @Karimi.1380
    @Karimi.1380 Рік тому

    hello bro build a search bar with html css and javascript

  • @pranavrhegde1851
    @pranavrhegde1851 21 день тому

    js part is not working

  • @Pcmagzine
    @Pcmagzine Рік тому

    How to make freelance website like fiverr

  • @CodeWithBalaji
    @CodeWithBalaji Рік тому +1

    it will fix error if there is no dob selected:
    if (isNaN(y3) || isNaN(m3) || isNaN(d3)) {
    result.innerHTML = `Please select your DOB`;
    } else {
    result.innerHTML = `You are ${y3} years, ${m3} months and ${d3} days old`;
    }

  • @Naina_is_not_working
    @Naina_is_not_working 7 місяців тому

    .input-box input::-webkit-calendar-picker-indicator ----- this is not working for firefox
    Solution: try to open in another browser and also check the calc()

  • @sarakhansarakhan792
    @sarakhansarakhan792 Рік тому

    Ye jo date ko calculate krny ka code likha iski smjh ni ai sir

  • @webninjadev
    @webninjadev 11 місяців тому

    it is not working properly

  • @neelumarif568
    @neelumarif568 Рік тому

    Please show full code I did but button is not working

    • @josefigarola5402
      @josefigarola5402 Рік тому

      Probably you forgot the event listener at the end of the js script
      userInput.addEventListener("input", calculateAge);

  • @sheikhrasel854
    @sheikhrasel854 Рік тому

    Wow! ❤❤❤

  • @lukekoletsios3236
    @lukekoletsios3236 Рік тому

    thanks

  • @tonsomar-coder
    @tonsomar-coder Рік тому

    Wanna Collab? 💙

  • @farhanalikhan2912
    @farhanalikhan2912 11 місяців тому

    ::-webkit-calender-picker-indicator not working can somebody help?

    • @AstroPlus_
      @AstroPlus_ 5 місяців тому

      Type it manually

  • @OlaRsk
    @OlaRsk 5 місяців тому

    Can anyone pls explain the last block of code?
    Line 56-59

  • @Z_Rokhri
    @Z_Rokhri Рік тому

    My calculate button isn't working, bro

    • @Epic_stickman90
      @Epic_stickman90 Рік тому

      Check if you spelled the name on the onclick right & make sure you have () in front of it

    • @zirconia1205
      @zirconia1205 Рік тому

      For me, it was undefined. My problem was the
      Let result = .document.getElementById
      After I erase the . In '.document', it worked.

    • @josefigarola5402
      @josefigarola5402 Рік тому

      i had to add userInput.addEventListener("input", calculateAge); at the end of my js file

  • @komal8917
    @komal8917 2 місяці тому

    My code is not working..in console result is showing 0 0 0

    • @kimayagupta8982
      @kimayagupta8982 Місяць тому

      you might have added birthDate values for d2, m2, y2. I also did it by mistake.
      Assign these values :
      let d2 = today.getDate();
      let m2 = today.getMonth() + 1;
      let y2 = today.getFullYear();

  • @tahashahid4186
    @tahashahid4186 11 місяців тому

    bro JavaScript code is not working you must need to see.

    • @baqigamer0
      @baqigamer0 8 місяців тому

      It's working bro

  • @salehabdullah-lt7fk
    @salehabdullah-lt7fk Рік тому +1

    Can somebody explain to me this part of the line below ".split("T")[0];"
    userInput.max = new Date().toISOString().split("T")[0];
    and this function :
    function getDaysInMonths(year, month){
    return new Date(year, month, 0).getDate();
    }
    Thanks.

    • @mohi7109
      @mohi7109 Рік тому

      it's my question too.

    • @salehabdullah-lt7fk
      @salehabdullah-lt7fk Рік тому

      @@mohi7109 kindly let me know when you have an idea about it.

    • @17-4-4
      @17-4-4 Рік тому

      reply if u find it

    • @shivanshurawat2309
      @shivanshurawat2309 3 місяці тому

      @salehabdullah-lt7fk .max signify that the maximum value that should be set and not beyond it . new Date() is refering to the object made of the current date which include something like this 2024-07-23T10:20:30.000Z.Then toISOstring() converts this into string like "2024-07-23T10:20:30.000Z" and then split("T") separate this into different string array elements like ["2024-07-23", "10:20 ",..] and then lastly index 0 is called so it will take "2024-07-23"]

    • @salehabdullah-lt7fk
      @salehabdullah-lt7fk 3 місяці тому +1

      @@shivanshurawat2309 Thanks for replying

  • @RohitSingh-yw7rg
    @RohitSingh-yw7rg Рік тому

    -webkit-calendar-picker-indicator not working

  • @anjalikhare2297
    @anjalikhare2297 9 місяців тому

    Code not working

  • @iamankusingh
    @iamankusingh Рік тому

    ❤❤

  • @mohsin_maqbool
    @mohsin_maqbool Рік тому

    This is not mobile-responsive

  • @sushantlimbu4953
    @sushantlimbu4953 11 місяців тому

    atleast give sourse code

  • @YashGuruModsoffical
    @YashGuruModsoffical 11 місяців тому +1

    Bhai kis chij ki jaldi h tujhe itni jaldi jaldi type kr leta h fir smjhane Beth jata h ,aur tujhe samjhana bi to nhi ata dhang se , agr koi Banda tere channel pr kuch sikhne aa rha h iska mtlb usko jaldi nhi h kisi chij ki vo aram se time nikal kr Sikh rha h kam se kam fast to Mt kr video ko , smjhana to ata nhi tujhe to dheere dheere hi likh bol bol kr taki hm khud se smjh ske .

  • @mohi7109
    @mohi7109 Рік тому

    Can somebody explain to me this part of the line below:
    ....}
    else {
    m3--;
    d3 = getDaysInMonth(y1, m1) + d2 - d1;
    }
    if (m3 < 0) {
    m3 = 11;
    y3--;
    }
    function getDaysInMonth(year, month) {
    return new Date(year, month, 0).getDate();
    }

    • @17-4-4
      @17-4-4 Рік тому

      pls explain

  • @surafelfikadu4331
    @surafelfikadu4331 28 днів тому

    ... 💚💛❤🙏

  • @Kim-d2u
    @Kim-d2u Рік тому

    24 oct 23

  • @satyamverma8286
    @satyamverma8286 5 місяців тому

    i don't like your videos i am having lot of issue in date picker option you should explain more

    • @anjinethmi6459
      @anjinethmi6459 5 місяців тому

      It's working. Try calc(100%) instead of calc(100% - 10px). Not related to time object. This is the where only that I get an error

  • @MyGamingEra
    @MyGamingEra Рік тому

    ::-webkit-calendar-picker-indicator not working 🥲

  • @petermwansa4890
    @petermwansa4890 9 місяців тому

    Thank you