@nextcloud/calendar-js
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "@nextcloud/calendar-js", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Small library that wraps ICAL.js and provide more convenient means for editing", | ||
@@ -28,2 +28,6 @@ "main": "src/index.js", | ||
"homepage": "https://github.com/nextcloud/calendar-js#readme", | ||
"engines": { | ||
"node": ">=14.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -39,7 +43,7 @@ "@babel/core": "^7.14.6", | ||
"eslint": "^7.31.0", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-loader": "^3.0.4", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-loader": "^4.0.2", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.3.1", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-standard": "^5.0.0", | ||
@@ -46,0 +50,0 @@ "eslint-plugin-vue": "^7.14.0", |
@@ -423,3 +423,6 @@ /** | ||
canCreateRecurrenceExceptions() { | ||
const primaryIsRecurring = this.primaryItem?.isRecurring() ?? false | ||
let primaryIsRecurring = false | ||
if (this.primaryItem && this.primaryItem.isRecurring()) { | ||
primaryIsRecurring = true | ||
} | ||
return this.isRecurring() || this.modifiesFuture() || (!this.isRecurring() && primaryIsRecurring) | ||
@@ -426,0 +429,0 @@ } |
@@ -59,2 +59,6 @@ /** | ||
getTimezoneForId(timezoneId) { | ||
return this._getTimezoneForIdRec(timezoneId, 0) | ||
} | ||
_getTimezoneForIdRec(timezoneId, level) { | ||
if (this._timezones.has(timezoneId)) { | ||
@@ -64,7 +68,12 @@ return this._timezones.get(timezoneId) | ||
if (level >= 20) { | ||
// too much recursion | ||
console.error('TimezoneManager.getTimezoneForIdRec() exceeds recursion limits') | ||
return null | ||
} | ||
if (this._aliases.has(timezoneId)) { | ||
const realTimezoneId = this._aliases.get(timezoneId) | ||
if (this._timezones.has(realTimezoneId)) { | ||
return this._timezones.get(realTimezoneId) | ||
} | ||
const resolvedTimezoneId = this._aliases.get(timezoneId) | ||
// can be a recursive alias: | ||
return this._getTimezoneForIdRec(resolvedTimezoneId, level + 1) | ||
} | ||
@@ -71,0 +80,0 @@ |
@@ -69,2 +69,23 @@ /** | ||
it('TimezoneManager should provide a method to get a timezone by id - by recursive alias', () => { | ||
const timezoneManager = new TimezoneManager() | ||
const tzKolkata = new Timezone('Asia/Kolkata', getAsset('timezone-asia-kolkata')) | ||
timezoneManager.registerTimezone(tzKolkata) | ||
timezoneManager.registerAlias('Asia/Calcutta', 'Asia/Kolkata') | ||
timezoneManager.registerAlias('India Standard Time', 'Asia/Calcutta') | ||
expect(timezoneManager.getTimezoneForId('India Standard Time')).toEqual(tzKolkata) | ||
}) | ||
it('TimezoneManager should provide a method to get a timezone by id - by recursive alias, recursion limit', () => { | ||
const timezoneManager = new TimezoneManager() | ||
timezoneManager.registerAlias('alias-one', 'alias-two') | ||
timezoneManager.registerAlias('alias-two', 'alias-one') | ||
expect(timezoneManager.getTimezoneForId('alias-one')).toEqual(null) | ||
}) | ||
it('TimezoneManager should provide a method to get a timezone by id - by alias non-existant', () => { | ||
@@ -71,0 +92,0 @@ const timezoneManager = new TimezoneManager() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1129083
196
26723