date diff
This commit is contained in:
parent
60d8d7501c
commit
7ae80ae062
10
js/date-difference/index.js
Normal file
10
js/date-difference/index.js
Normal file
@ -0,0 +1,10 @@
|
||||
const differenceInCalendarDays = require('date-fns/differenceInCalendarDays');
|
||||
|
||||
const earlier = new Date(2023, 6, 31);
|
||||
const later = new Date(2028, 6, 1);
|
||||
|
||||
const dif = differenceInCalendarDays(later, earlier);
|
||||
|
||||
console.log('from:', earlier.toLocaleDateString('en-GB', { dateStyle: 'full' }));
|
||||
console.log('to:', later.toLocaleDateString('en-GB', { dateStyle: 'full' }));
|
||||
console.log(dif);
|
31
js/date-difference/package-lock.json
generated
Normal file
31
js/date-difference/package-lock.json
generated
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "date-difference",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"date-fns": "^2.29.3"
|
||||
}
|
||||
},
|
||||
"node_modules/date-fns": {
|
||||
"version": "2.29.3",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz",
|
||||
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==",
|
||||
"engines": {
|
||||
"node": ">=0.11"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/date-fns"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"date-fns": {
|
||||
"version": "2.29.3",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz",
|
||||
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA=="
|
||||
}
|
||||
}
|
||||
}
|
5
js/date-difference/package.json
Normal file
5
js/date-difference/package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"date-fns": "^2.29.3"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user