You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/other/date.md
+63-62Lines changed: 63 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,123 +15,124 @@ description: "a set of date formatting methods"
15
15
16
16
### Details
17
17
18
-
The **date** object provides the following methods:
18
+
The `date` object provides the following methods:
19
19
20
-
-**add**(date, number, unit) - adds/subtracts the specified time interval to/from the date
21
-
-**date** - (<i>Date</i>) the date object that you need to add a time to/subtract a time from
22
-
-**number** - (<i>number</i>) the number of units to add. If this number is positive - the time will be added to the date, if negative - the time will be subtracted
23
-
-**unit** - (<i>'minute', 'hour', 'day', 'week', 'month', 'year'</i>) the time unit
20
+
-`add()` - adds/subtracts the specified time interval to/from the date
21
+
-`date` - (<i>Date</i>) the date object that you need to add time to/subtract time from
22
+
-`number` - (<i>number</i>) the number of units to add. If this number is positive, the time will be added to the date; if negative, the time will be subtracted
23
+
-`unit` - (<i>'minute', 'hour', 'day', 'week', 'month', 'year'</i>) the time unit
24
24
25
25
~~~js
26
-
//adds 1 year to the specified date: 29 June, 2019 -> 29 June, 2014
27
-
var newDate =scheduler.date.add(newDate(2019, 05, 29), 1, 'year');
26
+
//adds 1 year to the specified date: 29 June, 2027 -> 29 June, 2028
-**day_start**(date) - resets the time part of the provided date to 00:00:00. Alias of the <b>date_part</b> method. Used by the Day view to set the display date and can be redefined to provide the default behaviour
63
-
- **date** - (<i>Date</i>) the date object to format
62
+
-`day_start()` - resets the time part of the provided date to 00:00:00. Alias of the `date_part()` method. Used by the Day view to set the display date and can be redefined to provide the default behavior
63
+
Parameters: `date` - (<i>Date</i>) the date object to format
>**Note**, the date passed to the method will be actually changed. You may prevent the original date from being changed by wrapping the input date with *new Date*. For instance:
70
+
>**Note**, the date passed to the method will actually be changed. You may prevent the original date from being changed by wrapping the input date with `new Date()`. For instance:
71
71
72
72
~~~js
73
-
var date1=newDate(2019, 05, 29, 14, 30, 10))
74
-
var date2=scheduler.date.day_start(newDate(date1))
- <spanid="strtodate">**str_to_date**(format,utc,parseExact)</span> - returns a function that converts a string of the specified format to a Date object
100
-
- **format** - (<i>string</i>) the date format ( see [Date Format Specification](guides/settings-format.md))
101
-
- **utc** - (<i>boolean</i>) specifies whether local time should be converted to UTC
102
-
- **parseExact** - (<i>boolean</i>) defines whether Scheduler identifies the format of a date automatically (*false*, default) or uses the format passed a user (*true*)
99
+
<spanid="strtodate"></span>
100
+
-`str_to_date()` - returns a function that converts a string of the specified format to a Date object
101
+
Parameters: `format` - (<i>string</i>) the date format (see [Date Format Specification](guides/settings-format.md))
102
+
`utc` - (<i>boolean</i>) specifies whether local time should be converted to UTC
103
+
`parseExact` - (<i>boolean</i>) defines whether Scheduler identifies the format of a date automatically (*false*, default) or uses the format passed by a user (*true*)
103
104
~~~js
104
-
var formatFunc =scheduler.date.str_to_date("%d/%m/%Y");
105
-
var date =formatFunc("29/06/2019"); // -> 29 June, 2019 00:00:00
0 commit comments