Skip to content

Commit 3c8cd0d

Browse files
committed
fix replaceall bug in od and otmr
1 parent 3372263 commit 3c8cd0d

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

Obsidian.alfredworkflow

105 Bytes
Binary file not shown.

Obsidian/info.plist

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -860,14 +860,15 @@ var date_format_original = date_format;
860860
// get today's day if requested
861861
if (date_format.includes('dddd')) {
862862
day_string = days[day]
863-
date_format = date_format.replaceAll('dddd', 'zzzz')
863+
date_format = date_format.replace('dddd', 'zzzz')
864864
}
865865
if (date_format.includes('ddd')) {
866866
day_string_short = days_short[day]
867-
date_format = date_format.replaceAll('ddd', 'zzz')
867+
date_format = date_format.replace('ddd', 'zzz')
868868
}
869869
870-
// TODO clean up code
870+
// TODO clean up the two blocks of if statements
871+
// don't replace letter e or E that appear before/after alphabets
871872
if (date_format.includes('e')) {
872873
for (var i = 0; i < date_format.length; i++) {
873874
console.log(date_format.charAt(i));
@@ -1009,17 +1010,17 @@ if (m_char == 'mmm') {
10091010
10101011
// day of week if requested
10111012
if (date_format.includes('zzzz')) {
1012-
date_format = date_format.replaceAll('zzzz', day_string)
1013+
date_format = date_format.replace('zzzz', day_string)
10131014
}
10141015
if (date_format.includes('zzz')) {
1015-
date_format = date_format.replaceAll('zzz', day_string_short)
1016+
date_format = date_format.replace('zzz', day_string_short)
10161017
}
10171018
// e is day of week (0, 1, ... 7)
10181019
if (date_format_original.includes('e')) {
1019-
date_format = date_format.replaceAll('!!!', days_e[day].toString())
1020+
date_format = date_format.replace('!!!', days_e[day].toString())
10201021
}
10211022
if (date_format_original.includes('E')) {
1022-
date_format = date_format.replaceAll('@@@', days_E[day].toString())
1023+
date_format = date_format.replace('@@@', days_E[day].toString())
10231024
}
10241025
10251026
console.log('3. date_format: ' + date_format);
@@ -1195,11 +1196,11 @@ var date_format_original = date_format;
11951196
// get today's day if requested
11961197
if (date_format.includes('dddd')) {
11971198
day_string = days[day]
1198-
date_format = date_format.replaceAll('dddd', 'zzzz')
1199+
date_format = date_format.replace('dddd', 'zzzz')
11991200
}
12001201
if (date_format.includes('ddd')) {
12011202
day_string_short = days_short[day]
1202-
date_format = date_format.replaceAll('ddd', 'zzz')
1203+
date_format = date_format.replace('ddd', 'zzz')
12031204
}
12041205
12051206
// TODO clean up code
@@ -1221,15 +1222,15 @@ if (date_format.includes('e')) {
12211222
continue
12221223
} else {
12231224
console.log("replacing this e")
1224-
// date_format = date_format.replaceAll('e', '!!!')
1225+
// date_format = date_format.replace('e', '!!!')
12251226
date_format = date_format.substring(0, i) + '!!!' + date_format.substring(i + 1);
12261227
}
12271228
}
12281229
}
12291230
}
12301231
12311232
// if (date_format.includes('E')) {
1232-
// date_format = date_format.replaceAll('E', '@@@')
1233+
// date_format = date_format.replace('E', '@@@')
12331234
// }
12341235
if (date_format.includes('E')) {
12351236
for (var i = 0; i < date_format.length; i++) {
@@ -1249,7 +1250,7 @@ if (date_format.includes('E')) {
12491250
continue
12501251
} else {
12511252
console.log("replacing this E")
1252-
// date_format = date_format.replaceAll('e', '@@@')
1253+
// date_format = date_format.replace('e', '@@@')
12531254
date_format = date_format.substring(0, i) + '@@@' + date_format.substring(i + 1);
12541255
}
12551256
}
@@ -1344,17 +1345,17 @@ if (m_char == 'mmm') {
13441345
13451346
// day of week if requested
13461347
if (date_format.includes('zzzz')) {
1347-
date_format = date_format.replaceAll('zzzz', day_string)
1348+
date_format = date_format.replace('zzzz', day_string)
13481349
}
13491350
if (date_format.includes('zzz')) {
1350-
date_format = date_format.replaceAll('zzz', day_string_short)
1351+
date_format = date_format.replace('zzz', day_string_short)
13511352
}
13521353
// e is day of week (0, 1, ... 7)
13531354
if (date_format_original.includes('e')) {
1354-
date_format = date_format.replaceAll('!!!', days_e[day].toString())
1355+
date_format = date_format.replace('!!!', days_e[day].toString())
13551356
}
13561357
if (date_format_original.includes('E')) {
1357-
date_format = date_format.replaceAll('@@@', days_E[day].toString())
1358+
date_format = date_format.replace('@@@', days_E[day].toString())
13581359
}
13591360
13601361
console.log('3. date_format: ' + date_format);
@@ -4247,6 +4248,9 @@ RELEASE NOTES
42474248
42484249
Full documentation: https://github.com/hauselin/obsidian-alfred
42494250
4251+
v0.3.6
4252+
- Remove replaceAll in od and otmr to avoid bug in #25.
4253+
42504254
v0.3.5
42514255
- Fix od bug. #28 @lh00000000
42524256
@@ -4989,7 +4993,7 @@ If the Obsidian app isn't already opened, this workflow will always open the las
49894993
<string>dailyheader</string>
49904994
</array>
49914995
<key>version</key>
4992-
<string>0.3.5</string>
4996+
<string>0.3.6</string>
49934997
<key>webaddress</key>
49944998
<string>https://github.com/hauselin/obsidian-alfred</string>
49954999
</dict>

0 commit comments

Comments
 (0)