Skip to content

Commit 00257b1

Browse files
authored
Merge pull request #640 from add2cal/dev
Dev
2 parents acc8129 + d71f364 commit 00257b1

31 files changed

+57
-52
lines changed

assets/css/atcb-3d.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: 3D
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

assets/css/atcb-3d.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/atcb-date.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: Date
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

assets/css/atcb-date.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/atcb-flat.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: Flat
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

assets/css/atcb-flat.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/atcb-neumorphism.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: Neumorphism
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

assets/css/atcb-neumorphism.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/atcb-round.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: Round
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

assets/css/atcb-round.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/atcb-text.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: Text
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

assets/css/atcb-text.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/atcb.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: Default
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

assets/css/atcb.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/components/footer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function topFunction() {
7070
</span>
7171
<div class="mt-6 text-xs sm:mt-5 md:mt-3">
7272
<span class="font-semibold text-zinc-500 dark:text-zinc-400"> &copy; {{new Date().getFullYear()}} </span>
73-
<span class="lowercase text-zinc-400 dark:text-zinc-500"> , Current Version: 2.7.0 </span>
73+
<span class="lowercase text-zinc-400 dark:text-zinc-500"> , Current Version: 2.7.1 </span>
7474
</div>
7575
</div>
7676
<div class="hidden self-center sm:block">

demo/public/atcb.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Style: Default
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import js from '@eslint/js';
22
import prettierRecommended from 'eslint-plugin-prettier/recommended';
33
import regexpEslint from 'eslint-plugin-regexp';
4+
import pluginSecurity from 'eslint-plugin-security';
45
import wcEslint from 'eslint-plugin-wc';
56

67
export default [
@@ -13,6 +14,7 @@ export default [
1314
regexpEslint.configs['flat/recommended'],
1415
wcEslint.configs['flat/recommended'],
1516
prettierRecommended,
17+
pluginSecurity.configs.recommended,
1618
// overrides
1719
{
1820
files: ['**/*.{js,mjs,cjs}'],

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "add-to-calendar-button",
3-
"version": "2.7.0",
3+
"version": "2.7.1",
44
"engines": {
55
"node": ">=18.17.0",
66
"npm": ">=9.6.7"

src/atcb-control.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-decorate.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -367,8 +367,9 @@ function atcb_decorate_data_description(data, i) {
367367
// for each key in data.customVar, we replace any placeholders (%%placeholder%%) with the value
368368
if (data.customVar) {
369369
for (const key in data.customVar) {
370-
const sanitizedKey = key.replace(/[^\w\-.]/g, '');
371-
description = description.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
370+
const sanitizedKey = '%%' + key.replace(/[^\w\-.]/g, '') + '%%';
371+
// eslint-disable-next-line security/detect-non-literal-regexp
372+
description = description.replace(new RegExp(sanitizedKey, 'gi'), data.customVar[`${key}`]);
372373
}
373374
}
374375
// store a clean description copy without the URL magic for Yahoo, MS Teams, ...
@@ -435,9 +436,11 @@ function atcb_decorate_data_extend(data) {
435436
// for each key in data.customVar, we replace any placeholders (%%placeholder%%) in name and location with the value
436437
if (data.customVar) {
437438
for (const key in data.customVar) {
438-
const sanitizedKey = key.replace(/[^\w\-.]/g, '');
439-
data.dates[`${i}`].name = data.dates[`${i}`].name.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
440-
data.dates[`${i}`].location = data.dates[`${i}`].location.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
439+
const sanitizedKey = '%%' + key.replace(/[^\w\-.]/g, '') + '%%';
440+
// eslint-disable-next-line security/detect-non-literal-regexp
441+
data.dates[`${i}`].name = data.dates[`${i}`].name.replace(new RegExp(sanitizedKey, 'gi'), data.customVar[`${key}`]);
442+
// eslint-disable-next-line security/detect-non-literal-regexp
443+
data.dates[`${i}`].location = data.dates[`${i}`].location.replace(new RegExp(sanitizedKey, 'gi'), data.customVar[`${key}`]);
441444
}
442445
}
443446
}
@@ -454,34 +457,40 @@ function atcb_decorate_data_extend(data) {
454457

455458
// CALCULATE AND CLEAN UP THE ACTUAL DATES
456459
function atcb_date_cleanup(dateTimeData) {
460+
// Utility function to validate date format
461+
function isValidDateFormat(dateStr) {
462+
return /^\d\d\d\d-\d\d-\d\d(?:T\d\d:\d\d)?(?::\d\d)?(?:.\d\d\d)?Z?$/i.test(dateStr);
463+
}
464+
// Utility function to validate 'today' format
465+
function isValidTodayFormat(dateStr) {
466+
return /^today(?:\+(?:\d|\d\d|\d\d\d|\d\d\d\d))?$/i.test(dateStr);
467+
}
457468
// set endDate = startDate, if not provided
458469
if (!dateTimeData.endDate || dateTimeData.endDate === '') {
459470
dateTimeData.endDate = dateTimeData.startDate;
460471
}
461472
// parse date+time format (unofficial alternatives to the main implementation); also calculate any dynamic dates
462473
const endpoints = ['start', 'end'];
463474
endpoints.forEach(function (point) {
475+
const dateStr = dateTimeData[point + 'Date'];
464476
// validate first (we set some text instead, so the later validation picks it up as an error)
465-
if (!/^(?:\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2})?Z?|today(?:\+\d{1,4})?)$/i.test(dateTimeData[point + 'Date'])) {
477+
if (!isValidDateFormat(dateStr) && !isValidTodayFormat(dateStr)) {
466478
dateTimeData[point + 'Date'] = 'badly-formed';
467479
} else {
468480
// dynamic date replacement
469-
dateTimeData[point + 'Date'] = atcb_date_calculation(dateTimeData[point + 'Date']);
481+
if (isValidTodayFormat(dateStr)) dateTimeData[point + 'Date'] = atcb_date_calculation(dateStr);
470482
// second, if valid, clean up
471483
if (dateTimeData[point + 'Date']) {
472-
// remove any milliseconds information
473-
dateTimeData[point + 'Date'] = dateTimeData[point + 'Date'].replace(/\.\d{3}/, '').replace('Z', '');
474484
// identify a possible time information within the date string
475485
const tmpSplitStartDate = dateTimeData[point + 'Date'].split('T');
476486
if (tmpSplitStartDate[1]) {
477487
dateTimeData[point + 'Date'] = tmpSplitStartDate[0];
478488
dateTimeData[point + 'Time'] = tmpSplitStartDate[1];
479489
}
480490
}
481-
// remove any seconds from time information
482-
if (dateTimeData[point + 'Time'] && dateTimeData[point + 'Time'].length === 8) {
483-
const timeStr = dateTimeData[point + 'Time'];
484-
dateTimeData[point + 'Time'] = timeStr.substring(0, timeStr.length - 3);
491+
// remove any seconds and more from time information
492+
if (dateTimeData[point + 'Time'] && dateTimeData[point + 'Time'].length > 5) {
493+
dateTimeData[point + 'Time'] = dateTimeData[point + 'Time'].substring(0, 5);
485494
}
486495
}
487496
});
@@ -536,13 +545,7 @@ function atcb_date_calculation(dateString) {
536545
// check for any dynamic additions and adjust
537546
const dateStringParts = dateString.split('+');
538547
const dateParts = dateStringParts[0].split('-');
539-
let newDate = (function () {
540-
// backwards compatibility for version <1.5.0
541-
if (dateParts[0].length < 4) {
542-
return new Date(Date.UTC(dateParts[2], dateParts[0] - 1, dateParts[1]));
543-
}
544-
return new Date(Date.UTC(dateParts[0], dateParts[1] - 1, dateParts[2]));
545-
})();
548+
const newDate = new Date(Date.UTC(dateParts[0], dateParts[1] - 1, dateParts[2].substring(0, 2)));
546549
if (dateStringParts[1] && dateStringParts[1] > 0) {
547550
newDate.setDate(newDate.getDate() + parseInt(dateStringParts[1]));
548551
}

src/atcb-event.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-generate-pro.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-generate-rich-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-globals.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
* Add to Calendar Button
66
* ++++++++++++++++++++++
77
*
8-
* Version: 2.7.0
8+
* Version: 2.7.1
99
* Creator: Jens Kuerschner (https://jekuer.com)
1010
* Project: https://github.com/add2cal/add-to-calendar-button
1111
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
1212
* Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
1313
*
1414
*/
15-
const atcbVersion = '2.7.0';
15+
const atcbVersion = '2.7.1';
1616

1717
// DEFINING CSS
1818
const atcbCssTemplate = {};

src/atcb-i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-links.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

src/atcb-validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add to Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 2.7.0
6+
* Version: 2.7.1
77
* Creator: Jens Kuerschner (https://jekuer.com)
88
* Project: https://github.com/add2cal/add-to-calendar-button
99
* License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)

0 commit comments

Comments
 (0)