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:


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


import moment from 'moment';

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

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

Related Query

More Query from same tag