Skip to content

Commit

Permalink
- Fixed issue with the serialization of the date token.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Brink committed Jan 11, 2017
1 parent bcd2aa3 commit 34eb9e6
Show file tree
Hide file tree
Showing 8 changed files with 4,846 additions and 7 deletions.
20 changes: 14 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ var self = module.exports = {
if (self.calendars) {
self.calendars.forEach(function(calendar) {
var nextEvent = self.getNextEvent(calendar.events);

self.log("Next event found for calendar " + calendar.name + ": " + nextEvent);
if (nextEvent) {
var tokens = {
calendar: calendar.name,
date: nextEvent.start.format("YYYY-MM-DD"),
date: JSON.stringify(nextEvent.start.format("YYYY-MM-DD")),
time: nextEvent.start.format("HH:mm"),
summary: nextEvent.summary,
location: nextEvent.location
Expand All @@ -194,8 +194,15 @@ var self = module.exports = {
var state = nextEvent.departure || nextEvent.start;

//console.log("Next appointment's tokens: " + JSON.stringify(tokens));

Homey.manager("flow").trigger("next_appointment_in", tokens, state);
//console.log("Next appointment's state: " + JSON.stringify(state));

Homey.manager("flow")
.trigger("next_appointment_in",
tokens,
state,
function(err, result) {
if (err) return Homey.error(err);
});
}
});
}
Expand Down Expand Up @@ -464,7 +471,8 @@ var self = module.exports = {

if (occurrences) {
for (var i = 0; i < occurrences.length; i++) {
(function(e, start) {
(function (e, start) {
//self.log(JSON.stringify(start) + " isSameOrAfter " + JSON.stringify(today));
if (start.isSameOrAfter(today)) {
var eventDurationInMilliseconds = moment.utc(e.end).diff(moment.utc(e.start));
var eventDuration = moment.duration(eventDurationInMilliseconds);
Expand Down Expand Up @@ -498,7 +506,7 @@ var self = module.exports = {
}
}

//self.log(events.length + " events retrieved from ical: " + calendar.url);
//self.log(calendar.events.length + " events retrieved from ical: " + calendar.url);
callback(null, calendar.events);
}
});
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "nl.netactive.homey.ical2voice",
"version": "0.1.4",
"version": "0.9.0",
"compatibility": "0.x || 1.x",
"name": {
"en": "iCalendar to Voice",
Expand Down
9 changes: 9 additions & 0 deletions nl.netactive.homey.ical2voice.njsproj
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,15 @@
<Folder Include="node_modules\tunnel-agent\" />
<Folder Include="node_modules\underscore\" />
<Folder Include="settings\" />
<Folder Include="typings\" />
<Folder Include="typings\globals\" />
<Folder Include="typings\globals\moment\" />
<Folder Include="typings\globals\node\" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="typings\globals\moment\index.d.ts" />
<TypeScriptCompile Include="typings\globals\node\index.d.ts" />
<TypeScriptCompile Include="typings\index.d.ts" />
</ItemGroup>
<!-- Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
Expand Down
Loading

0 comments on commit 34eb9e6

Please sign in to comment.