score:2

Accepted answer

i used moment quite frequently. yarn add moment should do.

next import moment from "moment"

then you can call moment() anywhere in the file for example:

moment().endof("year").format("dd/mm/yyyy")

regardless, if it is a new project, consider avoiding moment and choosing a different library

score:0

import moment from 'moment';

...
const footer = () => {
    return (
      <footer classname="main-footer">
        <strong>
          copyright © {moment().format('y')}
        </strong>
        all rights reserved.
      </footer>
    );
  };
...
export default footer;

fyi, moment js is deprecated. consider using other library, like date-fns


Related Query

More Query from same tag