mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Get VTIMEZONE data from a time zone database lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
9b6238aabd
commit
a34f94df69
7 changed files with 44 additions and 22 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -22,6 +22,7 @@ import { getClient } from '../dav/client'
|
|||
import ICAL from 'ical.js'
|
||||
import logger from './logger'
|
||||
import { parseXML } from 'webdav/dist/node/tools/dav'
|
||||
import { getZoneString } from 'icalzone'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
export function getEmptySlots() {
|
||||
|
|
@ -107,11 +108,20 @@ export async function saveScheduleInboxAvailability(slots, timezoneId) {
|
|||
})))]
|
||||
|
||||
const vcalendarComp = new ICAL.Component('vcalendar')
|
||||
vcalendarComp.addPropertyWithValue('prodid', 'Nextcloud DAV app')
|
||||
|
||||
// Store time zone info
|
||||
const timezoneComp = new ICAL.Component('vtimezone')
|
||||
timezoneComp.addPropertyWithValue('tzid', timezoneId)
|
||||
vcalendarComp.addSubcomponent(timezoneComp)
|
||||
// If possible we use the info from a time zone database
|
||||
const predefinedTimezoneIcal = getZoneString(timezoneId)
|
||||
if (predefinedTimezoneIcal) {
|
||||
const timezoneComp = new ICAL.Component(ICAL.parse(predefinedTimezoneIcal))
|
||||
vcalendarComp.addSubcomponent(timezoneComp)
|
||||
} else {
|
||||
// Fall back to a simple markup
|
||||
const timezoneComp = new ICAL.Component('vtimezone')
|
||||
timezoneComp.addPropertyWithValue('tzid', timezoneId)
|
||||
vcalendarComp.addSubcomponent(timezoneComp)
|
||||
}
|
||||
|
||||
// Store availability info
|
||||
const vavailabilityComp = new ICAL.Component('vavailability')
|
||||
|
|
|
|||
11
package-lock.json
generated
11
package-lock.json
generated
|
|
@ -40,6 +40,7 @@
|
|||
"escape-html": "^1.0.3",
|
||||
"handlebars": "^4.7.7",
|
||||
"ical.js": "^1.4.0",
|
||||
"icalzone": "^0.0.1",
|
||||
"jquery": "~3.3",
|
||||
"jquery-migrate": "~3.3",
|
||||
"jquery-ui": "^1.13.0",
|
||||
|
|
@ -13629,6 +13630,11 @@
|
|||
"resolved": "https://registry.npmjs.org/ical.js/-/ical.js-1.4.0.tgz",
|
||||
"integrity": "sha512-ltHZuOFNNjcyEYbzDgjemS7LWIFh2vydJeznxQHUh3dnarbxqOYsWONYteBVAq1MEOHnwXFGN2eskZReHclnrA=="
|
||||
},
|
||||
"node_modules/icalzone": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/icalzone/-/icalzone-0.0.1.tgz",
|
||||
"integrity": "sha512-ln0AM3fMSLLuJijuWuRzwrN0Tg+BG8ADi7ha6slmC7ZqOijagif5I6b4Nl4/vPSXWexnxyrHiEof8VxDOllXVQ=="
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
|
|
@ -34560,6 +34566,11 @@
|
|||
"resolved": "https://registry.npmjs.org/ical.js/-/ical.js-1.4.0.tgz",
|
||||
"integrity": "sha512-ltHZuOFNNjcyEYbzDgjemS7LWIFh2vydJeznxQHUh3dnarbxqOYsWONYteBVAq1MEOHnwXFGN2eskZReHclnrA=="
|
||||
},
|
||||
"icalzone": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/icalzone/-/icalzone-0.0.1.tgz",
|
||||
"integrity": "sha512-ln0AM3fMSLLuJijuWuRzwrN0Tg+BG8ADi7ha6slmC7ZqOijagif5I6b4Nl4/vPSXWexnxyrHiEof8VxDOllXVQ=="
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
"escape-html": "^1.0.3",
|
||||
"handlebars": "^4.7.7",
|
||||
"ical.js": "^1.4.0",
|
||||
"icalzone": "^0.0.1",
|
||||
"jquery": "~3.3",
|
||||
"jquery-migrate": "~3.3",
|
||||
"jquery-ui": "^1.13.0",
|
||||
|
|
|
|||
Loading…
Reference in a new issue