Skip to content

Commit

Permalink
Merge pull request #4463 from david-poindexter/issue-3875-pages
Browse files Browse the repository at this point in the history
Migrate moment to dayjs for Pages.Web
  • Loading branch information
mitchelsellers authored Feb 8, 2021
2 parents a305a95 + 0941693 commit eca8bc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Dnn.AdminExperience/ClientSide/Pages.Web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"moment": "^2.22.2",
"dayjs": "^1.10.4",
"promise": "^8.0.2",
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-day-picker": "^7.2.4",
"url-parse": "^1.2.0"
}
}
}
8 changes: 5 additions & 3 deletions Dnn.AdminExperience/ClientSide/Pages.Web/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Moment from "moment";
import UrlParse from "url-parse";
import * as dayjs from "dayjs";
const localizedFormat = require('dayjs/plugin/localizedFormat');
let utilities = null;
let config = null;
let moduleName = null;
Expand Down Expand Up @@ -190,7 +191,8 @@ function formatDate(dateValue, longformat) {
return "-";
}

return Moment(dateValue).locale(utilities.getCulture()).format(longformat === true ? "LLL" : "L");
dayjs.extend(localizedFormat);
return dayjs(dateValue).locale(utilities.getCulture()).format(longformat === true ? "LLL" : "L");
}
function getUserMode() {
return config.userMode;
Expand Down Expand Up @@ -239,4 +241,4 @@ const utils = {
url
};

export default utils;
export default utils;

0 comments on commit eca8bc2

Please sign in to comment.