-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathplayground.js
More file actions
32 lines (29 loc) · 974 Bytes
/
Copy pathplayground.js
File metadata and controls
32 lines (29 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var itsadate = require('./index.js');
// Playground starts here --->
var currentDate = new Date(2020, 0, 14)
var settings = {
format_hints: {
day_before_month: true,
desc : 'When true then its-a-date expects dd/mm/yyyy, otherwise mm/dd/yyyy'
},
hint_strict: {
strict: false,
desc: 'when not strict, its-a-date will try different formats to prevent error'
},
timezone : {
gmt: 'auto',
desc: 'The GMT offset to add to the date in hours (e.g. -3)'
},
base_date : {
base_date: currentDate,
desc: 'What is the date from which you wish to calculate a relative date? (yesterday for 2010/10/10 != yesterday for today)'
},
restore: function() {
that.set({'gmt':'auto',
'day_before_month':true,
'strict':false,
'base_date':new Date()});
}
};
var s = itsadate.parse("1 week ago", settings);
console.log(s);