Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate moment to dayjs for Pages.Web #4463

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
}
6 changes: 4 additions & 2 deletions Dnn.AdminExperience/ClientSide/Pages.Web/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Moment from "moment";
import * as dayjs from "dayjs";
import UrlParse from "url-parse";
let utilities = null;
let config = null;
Expand Down Expand Up @@ -190,7 +190,9 @@ function formatDate(dateValue, longformat) {
return "-";
}

return Moment(dateValue).locale(utilities.getCulture()).format(longformat === true ? "LLL" : "L");
const localizedFormat = require('dayjs/plugin/localizedFormat');
valadas marked this conversation as resolved.
Show resolved Hide resolved
dayjs.extend(localizedFormat);
return dayjs(dateValue).locale(utilities.getCulture()).format(longformat === true ? "LLL" : "L");
}
function getUserMode() {
return config.userMode;
Expand Down