@dev-lperez/platzidate 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/README.md +10 -0
- package/package.json +15 -0
- package/src/index.js +25 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dev-lperez/platzidate",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Una utilidad para manejar fechas en formato timestamp y long time.",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"date",
|
|
11
|
+
"nodejs"
|
|
12
|
+
],
|
|
13
|
+
"author": "Luis Perez <luisperez0644@gmail.com>",
|
|
14
|
+
"license": "MIT"
|
|
15
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function getTimestamp() {
|
|
2
|
+
return Date.now();
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function getLongTime(locale = 'es-ES') {
|
|
6
|
+
const options = {
|
|
7
|
+
weekday: 'long',
|
|
8
|
+
year: 'numeric',
|
|
9
|
+
month: 'long',
|
|
10
|
+
day: 'numeric',
|
|
11
|
+
hour: 'numeric',
|
|
12
|
+
minute: 'numeric',
|
|
13
|
+
second: 'numeric',
|
|
14
|
+
timeZoneName: 'short'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return new Date().toLocaleString(locale, options);
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
getTimestamp,
|
|
24
|
+
getLongTime
|
|
25
|
+
};
|