srinu_rn-simple-date-formatter 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +14 -0
- package/package.json +18 -0
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { format } = require("date-fns");
|
|
2
|
+
|
|
3
|
+
function formatDate(date) {
|
|
4
|
+
if (!(date instanceof Date)) {
|
|
5
|
+
throw new Error("Invalid date");
|
|
6
|
+
}
|
|
7
|
+
return format(date, "yyyy-MM-dd");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function updatedConsole(message) {
|
|
11
|
+
console.log(`[Updated at ${new Date().toISOString()}] ${message}`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = { formatDate, updatedConsole };
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "srinu_rn-simple-date-formatter",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Package to format the date",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": ["date", "formatter", "utility", "npm package"],
|
|
10
|
+
"author": "Srinu Rachakonda",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"date-fns": "^4.1.0"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"react": "^19.2.4"
|
|
17
|
+
}
|
|
18
|
+
}
|