Skip to content

Commit 93ee730

Browse files
Merge pull request #32 from mlakatkou/GS-3195
[dev] update addMarker article
2 parents a249f6b + a8820d0 commit 93ee730

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

docs/api/method/addmarker.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ description: "adds a marker to the timeline area"
2222
### Example
2323

2424
~~~jsx
25-
var todayMarker = gantt.addMarker({
25+
const dateToString = gantt.date.date_to_str(gantt.config.task_date);
26+
const markerId = gantt.addMarker({
2627
start_date: new Date(),
2728
css: "today",
28-
title:date_to_str( new Date())
29+
title: dateToString(new Date())
2930
});
30-
setInterval(function(){
31-
var today = gantt.getMarker(todayMarker);
32-
today.start_date = new Date();
33-
today.title = date_to_str(today.start_date);
34-
gantt.updateMarker(todayMarker);
35-
}, 1000*60);
31+
32+
setInterval(() => {
33+
const marker = gantt.getMarker(markerId);
34+
marker.start_date = new Date();
35+
marker.title = dateToString(marker.start_date);
36+
gantt.updateMarker(markerId);
37+
}, 1000 * 60);
3638
~~~
3739

3840
### Related samples
@@ -41,10 +43,9 @@ setInterval(function(){
4143
### Details
4244

4345
:::note
44-
This method is defined in the **marker** extension, so you need to enable the [marker](guides/extensions-list.md#vertical-marker) plugin. Read the details in the [Adding Vertical Markers](guides/markers.md) article.
46+
This method is defined in the **marker** extension, so you need to enable the [marker](guides/extensions-list.md#vertical-marker) plugin. Read the details in the [Adding Vertical Markers](guides/markers.md) article.
4547
:::
4648

47-
4849
The configuration object has the following properties:
4950

5051
- **id?** - (*string | number*) - the marker id
@@ -63,4 +64,3 @@ The configuration object has the following properties:
6364

6465
### Related Guides
6566
- [Adding Vertical Markers](guides/markers.md)
66-

0 commit comments

Comments
 (0)