Skip to content

Commit

Permalink
Replace momentjs with dayjs for Servers.Web (#4104)
Browse files Browse the repository at this point in the history
* Replace momentjs with dayjs for Servers.Web

* Add dayjs license information
  • Loading branch information
david-poindexter committed Sep 20, 2020
1 parent 27bdca1 commit f4b08bf
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
30 changes: 30 additions & 0 deletions DNN Platform/Website/Licenses/dayjs (MIT).txt.resources
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PROJECT: dayjs

WHERE WE USE IT: As a reusable javascript library, as well as multiple places in the UI, see https://github.com/dnnsoftware/Dnn.Platform/search?q=dayjs&unscoped_q=dayjs

LICENSE TYPE: MIT

PROJECT LINK: https://github.com/iamkun/dayjs

LICENSE (AS OF 2020-09-20):
MIT License

Copyright (c) 2018-present, iamkun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 2 additions & 2 deletions Dnn.AdminExperience/ClientSide/Servers.Web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"babel-polyfill": "6.26.0",
"create-react-class": "^15.6.3",
"css-loader": "2.1.1",
"dayjs": "^1.8.36",
"eslint": "5.8.0",
"eslint-loader": "2.1.1",
"eslint-plugin-react": "7.11.1",
"eslint-plugin-spellcheck": "0.0.11",
"file-loader": "3.0.1",
"less": "3.9.0",
"less-loader": "5.0.0",
"moment": "^2.15.0",
"prop-types": "^15.6.2",
"raw-loader": "2.0.0",
"react": "^16.6.3",
Expand All @@ -46,4 +46,4 @@
"dependencies": {
"react-custom-scrollbars": "^4.1.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import React, { Component } from "react";
import { connect } from "react-redux";
import { Collapsible as Collapse } from "@dnnsoftware/dnn-react-common";
import "./style.less";
import moment from "moment";
import { log as LogActions } from "../../../actions";
import * as dayjs from "dayjs";

/*eslint-disable eqeqeq*/
class LogFileRow extends Component {
Expand All @@ -17,6 +16,9 @@ class LogFileRow extends Component {
};
this.timeout = 0;
this.handleClick = this.handleClick.bind(this);

const localizedFormat = require('dayjs/plugin/localizedFormat');
dayjs.extend(localizedFormat);
}

componentWillReceiveProps() {
Expand Down Expand Up @@ -100,7 +102,7 @@ class LogFileRow extends Component {
</div>
<div className="term-label-modifieddate">
<div className="term-label-wrapper">
<span>{moment(this.props.lastWriteTimeUtc).format("LLL")}</span>
<span>{dayjs(this.props.lastWriteTimeUtc).format("LLL")}</span>
</div>
</div>
<div className="term-label-size">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import moment from "moment";
import * as dayjs from "dayjs";
import serviceFramework from "./serviceFramework";

const getLogs = function () {
Expand Down Expand Up @@ -27,7 +27,7 @@ const getLogs = function () {

return logList
.concat(upgradeLogList)
.sort((a, b) => moment(b.lastWriteTimeUtc) - moment(a.lastWriteTimeUtc));
.sort((a, b) => dayjs(b.lastWriteTimeUtc) - dayjs(a.lastWriteTimeUtc));
});
};

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5747,6 +5747,11 @@ dateformat@^3.0.0:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==

dayjs@^1.8.36:
version "1.8.36"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.8.36.tgz#be36e248467afabf8f5a86bae0de0cdceecced50"
integrity sha512-3VmRXEtw7RZKAf+4Tv1Ym9AGeo8r8+CjDi26x+7SYQil1UqtqdaokhzoEJohqlzt0m5kacJSDhJQkG/LWhpRBw==

debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
Expand Down

0 comments on commit f4b08bf

Please sign in to comment.