Skip to content

Commit

Permalink
style: fix prettier config (nhn#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
jungeun-cho committed Nov 22, 2020
1 parent 6d4d635 commit 76b9d6b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"plugins": ["prettier"],
"extends": ["tui", "plugin:prettier/recommended"],
"extends": ["tui"],
"globals": {
"chance": true,
"moment": true
Expand Down
15 changes: 0 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"devDependencies": {
"css-loader": "^3.2.0",
"eslint": "^4.19.1",
"eslint-config-prettier": "^6.15.0",
"eslint-config-tui": "^1.0.3",
"eslint-loader": "^2.0.0",
"eslint-plugin-jasmine": "^2.10.1",
Expand Down
44 changes: 22 additions & 22 deletions src/js/common/timezone.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var getterMethods = [
'getMilliseconds',
'getMinutes',
'getMonth',
'getSeconds',
'getSeconds'
];

var setterMethods = [
Expand All @@ -30,7 +30,7 @@ var setterMethods = [
'setMilliseconds',
'setMinutes',
'setMonth',
'setSeconds',
'setSeconds'
];

/**
Expand Down Expand Up @@ -169,7 +169,7 @@ function TZDate(date) {
* Get milliseconds which is converted by timezone
* @returns {number} milliseconds
*/
TZDate.prototype.getTime = function () {
TZDate.prototype.getTime = function() {
var time = this._date.getTime();

return time + getCustomTimezoneOffset(time) - getTimezoneOffset(time);
Expand All @@ -179,50 +179,50 @@ TZDate.prototype.getTime = function () {
* Get UTC milliseconds
* @returns {number} milliseconds
*/
TZDate.prototype.getUTCTime = function () {
TZDate.prototype.getUTCTime = function() {
return this._date.getTime();
};

/**
* toUTCString
* @returns {string}
*/
TZDate.prototype.toUTCString = function () {
TZDate.prototype.toUTCString = function() {
return this._date.toUTCString();
};

/**
* to Date
* @returns {Date}
*/
TZDate.prototype.toDate = function () {
TZDate.prototype.toDate = function() {
return this._date;
};

TZDate.prototype.valueOf = function () {
TZDate.prototype.valueOf = function() {
return this.getTime();
};

TZDate.prototype.addDate = function (day) {
TZDate.prototype.addDate = function(day) {
this.setDate(this.getDate() + day);

return this;
};

TZDate.prototype.addMinutes = function (minutes) {
TZDate.prototype.addMinutes = function(minutes) {
this.setMinutes(this.getMinutes() + minutes);

return this;
};

TZDate.prototype.addMilliseconds = function (milliseconds) {
TZDate.prototype.addMilliseconds = function(milliseconds) {
this.setMilliseconds(this.getMilliseconds() + milliseconds);

return this;
};

/* eslint-disable max-params*/
TZDate.prototype.setWithRaw = function (y, M, d, h, m, s, ms) {
TZDate.prototype.setWithRaw = function(y, M, d, h, m, s, ms) {
this.setFullYear(y, M, d);
this.setHours(h, m, s, ms);

Expand All @@ -232,22 +232,22 @@ TZDate.prototype.setWithRaw = function (y, M, d, h, m, s, ms) {
/**
* @returns {TZDate} local time
*/
TZDate.prototype.toLocalTime = function () {
TZDate.prototype.toLocalTime = function() {
var time = this.getTime();
var utcTime = this.getUTCTime();
var diff = time - utcTime;

return new TZDate(utcTime - diff);
};

getterMethods.forEach(function (methodName) {
TZDate.prototype[methodName] = function () {
getterMethods.forEach(function(methodName) {
TZDate.prototype[methodName] = function() {
return this._date[methodName].apply(this._date, arguments);
};
});

setterMethods.forEach(function (methodName) {
TZDate.prototype[methodName] = function () {
setterMethods.forEach(function(methodName) {
TZDate.prototype[methodName] = function() {
this._date[methodName].apply(this._date, arguments);

return this.getTime();
Expand All @@ -261,15 +261,15 @@ module.exports = {
* Set offset
* @param {number} offset - timezone offset based on minutes
*/
setOffset: function (offset) {
setOffset: function(offset) {
customOffsetMs = offset * MIN_TO_MS;
},

/**
* Set offset
* @param {number} offset - timezone offset based on minutes
*/
setOffsetByTimezoneOption: function (offset) {
setOffsetByTimezoneOption: function(offset) {
this.setOffset(-offset);
setByTimezoneOption = true;
},
Expand All @@ -278,7 +278,7 @@ module.exports = {
* Get offset in case of `setByTimezoneOption`. Or return 0.
* @returns {number} timezone offset offset minutes
*/
getOffset: function () {
getOffset: function() {
if (setByTimezoneOption) {
return customOffsetMs / MIN_TO_MS;
}
Expand All @@ -290,15 +290,15 @@ module.exports = {
* Set a callback function to get timezone offset by timestamp
* @param {function} callback - callback function
*/
setOffsetCallback: function (callback) {
setOffsetCallback: function(callback) {
timezoneOffsetCallback = callback;
},

/**
* (Use this method only for testing)
* Reset system timezone and custom timezone
*/
restoreOffset: function () {
restoreOffset: function() {
customOffsetMs = getTimezoneOffset();
},
}
};

0 comments on commit 76b9d6b

Please sign in to comment.