-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from PRO100BYTE/update-date-command
Update date & time command
- Loading branch information
Showing
2 changed files
with
10 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
import dateFormat from "dateformat"; | ||
const date = new Date(); | ||
const d = dateFormat(date, "ddd m-dd-yyyy"); | ||
|
||
export default class DateCommand { | ||
execute(term, params, directory, setDirectory) { | ||
const date = new Date(); | ||
const d = dateFormat(date, "ddd m-dd-yyyy"); | ||
term.writeln(''); | ||
term.writeln(`Current date is ${d}`); | ||
term.writeln(''); | ||
} | ||
|
||
description() { | ||
return "Return current date"; | ||
return "Print current date"; | ||
} | ||
|
||
help(term) { | ||
term.writeln("Usage: date") | ||
term.writeln("This command prints the current date in the format ddd m-dd-yyyy") | ||
term.writeln("Sample output: Thu 01-01-1970") // Current date is Thu 01-01-1970 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters