Skip to content

Commit

Permalink
Merge pull request #64 from PRO100BYTE/update-date-command
Browse files Browse the repository at this point in the history
Update date & time command
  • Loading branch information
mraliscoder authored Jan 2, 2024
2 parents a763e19 + a853a24 commit 4910a58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/commands/General/date.js
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
}
}
1 change: 1 addition & 0 deletions src/commands/General/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default class TimeCommand {
help(term) {
term.writeln("Usage: time");
term.writeln("This command prints the current time in the format HH:mm:ss.SSS");
term.writeln("Sample output: 12:34:30.00") // Current time is 12:34:30:00
}
}

0 comments on commit 4910a58

Please sign in to comment.