diff --git a/src/components/Footer/index.js b/src/components/Footer/index.js index 0aaad529..6300e2bd 100644 --- a/src/components/Footer/index.js +++ b/src/components/Footer/index.js @@ -4,11 +4,12 @@ import TranslationContext from "Layout/TranslationContext"; const Footer = () => { const getTranslation = useContext(TranslationContext); + const currentYear = new Date().getFullYear(); return (
- Copyright © 2012-2022   + Copyright © 2012-{Math.max(2023, Number(__BUILD_YEAR__), currentYear)}   {getTranslation("Institute of Linguistics Russian Academy of Sciences")} diff --git a/webpack/utils.js b/webpack/utils.js index 438107b6..9851690b 100644 --- a/webpack/utils.js +++ b/webpack/utils.js @@ -63,6 +63,14 @@ if ("LINGVODOC_BUILD_TYPE" in process.env) { versionString += process.env.LINGVODOC_BUILD_TYPE; } +/* Constructing current year. */ + +var buildYear = ""; + +try { + buildYear = new Date().getFullYear().toString(); +} catch (error) {} + module.exports = { cwd(file) { return path.join(process.cwd(), file || ""); @@ -80,5 +88,6 @@ module.exports = { } }; }, - versionString + versionString, + buildYear }; diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index bebbb805..9a2affdc 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -54,7 +54,8 @@ base.plugins.push( }), new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("development"), - __VERSION__: JSON.stringify(_.versionString) + __VERSION__: JSON.stringify(_.versionString), + __BUILD_YEAR__: JSON.stringify(_.buildYear) }), new webpack.HotModuleReplacementPlugin(), new ReactRefreshWebpackPlugin(), diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js index d1403a5b..92853b68 100644 --- a/webpack/webpack.prod.js +++ b/webpack/webpack.prod.js @@ -64,7 +64,8 @@ base.plugins.push( new MiniCssExtractPlugin({ filename: "[name].[contenthash:8].css", chunkFilename: "[id].[contenthash:8].css" }), new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("production"), - __VERSION__: JSON.stringify(_.versionString) + __VERSION__: JSON.stringify(_.versionString), + __BUILD_YEAR__: JSON.stringify(_.buildYear) }) );