console-timestamp
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -43,5 +43,13 @@ /** | ||
out = out.replace("YY", date.getFullYear().toString().slice(-2), "g"); | ||
out = out.replace("MM", fixDigits(date.getMonth(), 2), "g"); | ||
out = out.replace("MM", fixDigits(date.getMonth()+1, 2), "g"); | ||
out = out.replace("DD", fixDigits(date.getDate(), 2), "g"); | ||
return out; | ||
}; | ||
Object.defineProperty(String.prototype, 'timestamp', { | ||
get: function () { | ||
return module.exports(this); | ||
} | ||
}); |
{ | ||
"name": "console-timestamp", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Simple date formatter for logging purposes", | ||
@@ -5,0 +5,0 @@ "main": "console-timestamp.js", |
@@ -6,4 +6,6 @@ console-timestamp | ||
There's only one function. | ||
There's one function and one String property included. | ||
**Timestamp function** | ||
```timestamp([format, time]);``` | ||
@@ -22,2 +24,6 @@ | ||
**String getter** | ||
Now, you can use a new String getter ```'hh:mm:ss'.timestamp``` which will replace placeholders in the string. You can't specify a date then. The values are automatically set to current time. It's just a shortcut for the regular function. | ||
Examples | ||
@@ -32,2 +38,4 @@ ================= | ||
console.log('hh:mm:ss'.timestamp); //13:58:29 | ||
console.log('DD-MM-YY hh:mm'.timestamp); //28-03-14 14:43 | ||
console.log(timestamp()); //15:43:20 | ||
@@ -34,0 +42,0 @@ console.log(timestamp('DD-MM-YYYY hh:mm:ss:iii')); //04-07-2014 14:32:45:891 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5326
44
45