Skip to content

Commit

Permalink
feat(list): output date in user's locale
Browse files Browse the repository at this point in the history
  • Loading branch information
YodaDaCoda committed Aug 31, 2021
1 parent 26ca06c commit ea362d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "salesforcedx-apex",
"dependencies": {
"dateformat": "^4.5.1",
"node": "12.4.0",
"npm": "^6.9.0"
},
"devDependencies": {
"@commitlint/cli": "^7",
"@commitlint/config-conventional": "^7",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@types/dateformat": "^3.0.1",
"@types/mocha": "^5",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"commitizen": "^3.0.5",
"cz-conventional-changelog": "^2.1.0",
Expand Down
6 changes: 2 additions & 4 deletions packages/plugin-apex/src/commands/force/apex/log/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as dateformat from 'dateformat';
import { LogRecord, LogService, Table, Row } from '@salesforce/apex-node';
import { flags, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
Expand Down Expand Up @@ -135,10 +136,7 @@ export default class List extends SfdxCommand {
}

private formatTime(time: string): string {
const milliIndex = time.indexOf('.');
if (milliIndex !== -1) {
return time.substring(0, milliIndex) + time.substring(milliIndex + 4);
}
time = dateformat(time, 'isoDateTime');
return time;
}
}
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,11 @@
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"

"@types/dateformat@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-3.0.1.tgz#98d747a2e5e9a56070c6bf14e27bff56204e34cc"
integrity sha512-KlPPdikagvL6ELjWsljbyDIPzNCeliYkqRpI+zea99vBBbCIA5JNshZAwQKTON139c87y9qvTFVgkFd14rtS4g==

"@types/eslint-visitor-keys@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
Expand Down Expand Up @@ -2033,6 +2038,11 @@ dateformat@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"

dateformat@^4.5.1:
version "4.5.1"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.5.1.tgz#c20e7a9ca77d147906b6dc2261a8be0a5bd2173c"
integrity sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q==

[email protected]:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
Expand Down

0 comments on commit ea362d8

Please sign in to comment.