Skip to content

Commit 786db14

Browse files
committed
### 3.6.5 (2019-02-13)
* (bluefox) Error with formatDate was fixed
1 parent d28b8a8 commit 786db14

File tree

4 files changed

+62
-13
lines changed

4 files changed

+62
-13
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Hier kann man die Beschreibung von [Blockly](doc/de/blockly.md) finden.
2121
Описание по [blockly](doc/ru/blockly.md) можно найти [здесь](doc/ru/blockl.md).
2222

2323
## Changelog
24+
### 3.6.5 (2019-02-13)
25+
* (bluefox) Error with formatDate was fixed
26+
2427
### 3.6.4 (2018-02-05)
2528
* (bluefox) Pattern error is fixed
2629

io-package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"common": {
33
"name": "javascript",
4-
"version": "3.6.4",
4+
"version": "3.6.5",
55
"title": "Script Engine",
66
"titleLang": {
77
"en": "Script Engine",
@@ -20,6 +20,18 @@
2020
"Apollon77 <ingo@fischer-ka.de>"
2121
],
2222
"news": {
23+
"3.6.5": {
24+
"en": "Error with formatDate was fixed",
25+
"de": "Fehler bei formatDate wurde behoben",
26+
"ru": "Ошибка с formatDate была исправлена",
27+
"pt": "Erro com formatDate foi corrigido",
28+
"nl": "Fout met formatDate is opgelost",
29+
"fr": "Erreur avec formatDate a été corrigé",
30+
"it": "Errore con formatDate risolto",
31+
"es": "El error con formatDate fue corregido",
32+
"pl": "Naprawiono błąd z formatDate",
33+
"zh-cn": "修复了formatDate的错误"
34+
},
2335
"3.6.4": {
2436
"en": "Pattern error is fixed",
2537
"de": "Musterfehler ist behoben",

javascript.js

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@
290290

291291
if (id === 'system.config') {
292292
// set langugae for debug messages
293-
if (objects['system.config'].common.language) words.setLanguage(objects['system.config'].common.language);
293+
if (objects['system.config'].common && objects['system.config'].common.language) {
294+
words.setLanguage(objects['system.config'].common.language);
295+
}
294296
}
295297

296298
return;
@@ -2697,19 +2699,37 @@
26972699
script.onStopTimeout = timeout || 1000;
26982700
},
26992701
formatValue: function (value, decimals, format) {
2700-
if (!format && objects['system.config']) {
2701-
format = objects['system.config'].common.isFloatComma ? '.,' : ',.';
2702+
if (!format) {
2703+
if (adapter.isFloatComma !== undefined) {
2704+
format = adapter.isFloatComm ? '.,' : ',.';
2705+
} else if (objects['system.config'] && objects['system.config'].common) {
2706+
format = objects['system.config'].common.isFloatComma ? '.,' : ',.';
2707+
}
27022708
}
27032709
return adapter.formatValue(value, decimals, format);
27042710
},
27052711

27062712
formatDate: function (date, format, language) {
27072713
if (!format) {
2708-
format = objects['system.config'] ? (objects['system.config'].common.dateFormat || 'DD.MM.YYYY') : 'DD.MM.YYYY';
2714+
if (adapter.dateFormat) {
2715+
format = adapter.dateFormat;
2716+
} else if (objects['system.config'] && objects['system.config'].common) {
2717+
format = objects['system.config'] ? (objects['system.config'].common.dateFormat || 'DD.MM.YYYY') : 'DD.MM.YYYY';
2718+
}
2719+
format = format || 'DD.MM.YYYY';
27092720
}
27102721
if (format.match(/W|Н|O|О/)) {
27112722
var text = adapter.formatDate(date, format);
2712-
if (!language || !dayOfWeeksFull[language]) language = objects['system.config'].common.language;
2723+
if (!language || !dayOfWeeksFull[language]) {
2724+
if (adapter.language) {
2725+
language = adapter.language;
2726+
} else {
2727+
language = objects['system.config'] && objects['system.config'].common && objects['system.config'].common.language;
2728+
}
2729+
if (!dayOfWeeksFull[language]) {
2730+
language = 'de';
2731+
}
2732+
}
27132733
var d = date.getDay();
27142734
text = text.replace('WW', dayOfWeeksFull[language][d]);
27152735
text = text.replace('НН', dayOfWeeksFull[language][d]);
@@ -2826,7 +2846,11 @@
28262846
var timeoutMs = parseInt(options.timeout, 10) || 20000;
28272847

28282848
if (!instance) {
2829-
instance = objects['system.config'] ? objects['system.config'].common.defaultHistory : null;
2849+
if (adapter.defaultHistory) {
2850+
instance = adapter.defaultHistory;
2851+
} else {
2852+
instance = objects['system.config'] && objects['system.config'].common ? objects['system.config'].common.defaultHistory : null;
2853+
}
28302854
}
28312855

28322856
if (sandbox.verbose) sandbox.log('getHistory(instance=' + instance + ', options=' + JSON.stringify(options) + ')', 'debug');
@@ -3327,14 +3351,24 @@
33273351
}
33283352
addGetProperty(objects);
33293353

3354+
var systemConfig = objects['system.config'];
3355+
33303356
// set language for debug messages
3331-
if (objects['system.config'] && objects['system.config'].common.language) words.setLanguage(objects['system.config'].common.language);
3357+
if (systemConfig && systemConfig.common && systemConfig.common.language) {
3358+
words.setLanguage(systemConfig.common.language);
3359+
} else if (adapter.language) {
3360+
words.setLanguage(adapter.language);
3361+
}
33323362

33333363
// try to use system coordinates
3334-
if (adapter.config.useSystemGPS && objects['system.config'] &&
3335-
objects['system.config'].common.latitude) {
3336-
adapter.config.latitude = objects['system.config'].common.latitude;
3337-
adapter.config.longitude = objects['system.config'].common.longitude;
3364+
if (adapter.config.useSystemGPS) {
3365+
if (systemConfig && systemConfig.common && systemConfig.common.latitude) {
3366+
adapter.config.latitude = systemConfig.common.latitude;
3367+
adapter.config.longitude = systemConfig.common.longitude;
3368+
} else if (adapter.latitude) {
3369+
adapter.config.latitude = adapter.latitude;
3370+
adapter.config.longitude = adapter.longitude;
3371+
}
33383372
}
33393373
adapter.config.latitude = parseFloat(adapter.config.latitude);
33403374
adapter.config.longitude = parseFloat(adapter.config.longitude);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iobroker.javascript",
3-
"version": "3.6.4",
3+
"version": "3.6.5",
44
"description": "Javascript/Coffescript Script Engine for ioBroker",
55
"author": "bluefox <dogafox@gmail.com>",
66
"contributors": [

0 commit comments

Comments
 (0)