Make sure that your website UpToDate ! (TS)

Make sure that your website UpToDate ! (TS)

·

1 min read

this a very short one but it's important , when you create a website make sure that you don't put any numbers or dates in the footer

Ex :

function Layout(props) {
  return (
    <footer>
      <div 
           Divzoon &copy; 2022-2018
      </div>
    </footer>
  );
}

export default Layout;

instead you need to put a method that get the date for you :

why ?

  • doing it that way prevent your website to be outdated .
  • if there is any logic related to time or date it's going to break new year when the time change . ... etc.

How could we solve it ?

  • in TS :
// create an object 
const currentYear = new Date().getFullYear();


// put it inside your component .

const footer= () => {
  return (
    <div>
      <div>
           Divzoon &copy;  {currentYear} - 2018
      </div>
    </div>
  );
};

export default footer;