Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
lib-ical
Commits
d3a16d6f
Commit
d3a16d6f
authored
Dec 08, 2015
by
Karel Kozlík
Browse files
Adding support for sequence number property
parent
b76ed63e
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d3a16d6f
...
...
@@ -274,6 +274,12 @@ Empty the Calender.
Use this method to set the event's ID. If not set, an UID will be generated randomly.
#### sequence([_Integer_ sequence])
Use this method to set the event's revision sequence number of the
calendar component within a sequence of revisions.
#### start([_Date_ start])
Appointment date of beginning as Date object. This is required for all events!
...
...
lib/event.js
View file @
d3a16d6f
...
...
@@ -7,7 +7,7 @@
* @constructor ICalEvent Event
*/
var
ICalEvent
=
function
(
_data
)
{
var
attributes
=
[
'
id
'
,
'
uid
'
,
'
start
'
,
'
end
'
,
'
stamp
'
,
'
timestamp
'
,
'
allDay
'
,
'
floating
'
,
'
repeating
'
,
'
summary
'
,
'
location
'
,
'
description
'
,
'
organizer
'
,
'
attendees
'
,
'
alarms
'
,
'
method
'
,
'
status
'
,
'
url
'
],
var
attributes
=
[
'
id
'
,
'
uid
'
,
'
sequence
'
,
'
start
'
,
'
end
'
,
'
stamp
'
,
'
timestamp
'
,
'
allDay
'
,
'
floating
'
,
'
repeating
'
,
'
summary
'
,
'
location
'
,
'
description
'
,
'
organizer
'
,
'
attendees
'
,
'
alarms
'
,
'
method
'
,
'
status
'
,
'
url
'
],
vars
,
i
,
data
;
...
...
@@ -20,6 +20,7 @@ var ICalEvent = function(_data) {
data
=
{
id
:
(
'
0000
'
+
(
Math
.
random
()
*
Math
.
pow
(
36
,
4
)
<<
0
).
toString
(
36
)).
substr
(
-
4
),
sequence
:
0
,
start
:
null
,
end
:
null
,
stamp
:
new
Date
(),
...
...
@@ -65,6 +66,22 @@ var ICalEvent = function(_data) {
this
.
uid
=
this
.
id
;
/**
* Set/Get the event's SEQUENCE number
*
* @param id SEQUENCE
* @since 0.2.6
* @returns {ICalEvent|Integer}
*/
this
.
sequence
=
function
(
sequence
)
{
if
(
!
sequence
)
{
return
data
.
sequence
;
}
data
.
sequence
=
sequence
;
return
this
;
};
/**
* Set/Get the event's start date
*
...
...
@@ -566,6 +583,10 @@ var ICalEvent = function(_data) {
// DATE & TIME
g
+=
'
BEGIN:VEVENT
\r\n
'
;
g
+=
'
UID:
'
+
data
.
id
+
'
@
'
+
calendar
.
domain
()
+
'
\r\n
'
;
// SEQUENCE
g
+=
'
SEQUENCE:
'
+
data
.
sequence
+
'
\r\n
'
;
g
+=
'
DTSTAMP:
'
+
tools
.
formatDate
(
data
.
stamp
)
+
'
\r\n
'
;
if
(
data
.
allDay
)
{
g
+=
'
DTSTART;VALUE=DATE:
'
+
tools
.
formatDate
(
data
.
start
,
true
)
+
'
\r\n
'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment