Select last day of the month for a specific date

4 replies
  1. japanfever
    japanfever says:

    //Here in Los Angeles it does not work:

    const date = new Date()


    new Date(date.getFullYear(), date.getMonth() + 1, 1).toISOString().slice(0, 10)
    //’2018-06-01′ ???

    • Génesis
      Génesis says:

      Long time, no see! ^^ What are u doing there? Did you get a scholarship?
      I tested in FF and Chrome and it works, even I launched Chromium with faketime in the terminal and it’s ok.
      Which browser and version are you using?

      • japanfever
        japanfever says:

        i have family in Los Angeles. in my laptop with Tokyo timezone it works, i’think it only works for some time zones … it’s very easy 2b a troll with you .. your implementation is not very good. something like that is better:

        let now = new Date()
        let year = now.getFullYear()
        let month = now.getMonth()
        console.log((new Date(Date.UTC(year,month+1,1)-86400000)).toISOString().slice(0,10))

        what is `Chromium with faketime`? i use `Firefox Quantum 60.0`, the best browser!!!

        • Génesis
          Génesis says:

          Hope you are having a great time there!

          – Chromium is the open-source browser behind Chrome.
          – faketime lets you change the time of applications.

          I use both FF and Chromium (never Chrome) but yes they sped up FireFox a lot with Quantum.

Comments are closed.