In Synchronet JavaScript, does anyone know if there's a way to get the setting for whether to use European date format (as under SCFG > System > Toggle Options > European Date Format (DD/MM/YY))? I've checked in the Synchronet JavaScript Object Model Reference but I'm not seeing where that
In Synchronet JavaScript, does anyone know if there's a way to get
the setting for whether to use European date format (as under SCFG >
I don't think that setting is exposed to the JS environment, however the output of the system.datestr method is dictated by it.
Thanks. Maybe there is a way to figure out the date format being used with that.. I'll have to look into that.
if(strftime("%d/%m/%y") == system.datestr()) {
// Format in use is dd/mm/yy
} else {
// Format in use is mm/dd/yy
}
Or perhaps better:
var t = time();
var dmy = (strftime("%d/%m/%y", t) == system.datestr(t)) ? true : false;
Which is probably overly cautious, and you could just do:
var dmy = (strftime("%d/%m/%y") == system.datestr()) ? true : false;
var t = time();
var dmy = (strftime("%d/%m/%y", t) == system.datestr(t)) ? true :
false;
Thanks. :)
By the way, the ? true : false is redundant. This should be enough to get a boolean value:
var dmy = (strftime("%d/%m/%y", t) == system.datestr(t));
I'm trying to guess at why you want to determine the value of this
setting in the first place - figuring out how to format a field label or column heading?
Probably something like:
if(strftime("%d/%m/%y") == system.datestr()) {
// Format in use is dd/mm/yy
} else {
// Format in use is mm/dd/yy
}
Better off using a known time value to avoid misdetection when the day is the same as the month. system.datestr() can take a time_t value, so use constants:
load("sbbsdefs.js");
if (system.setting & SYS_EURODATE)...
Ah, it is available...
load("sbbsdefs.js");
if (system.setting & SYS_EURODATE)...
Do you mean system.settings ('s' at the end)? I see that mentioned in the Synchronet JavaScript docs:
www.synchro.net/docs/jsobjs.html#system
Also, that documentation page says to see SS_* in sbbsdefs.js for bit definitions; in sbbsdefs.js, there is a comment that says SS_* are for bbs.sys_status and the SYS_* settings are for system.settings - So I'm wondering if that documentation page needs to be updated?
Sysop: | Tandy |
---|---|
Location: | New York, USA |
Users: | 15 |
Nodes: | 13 (0 / 13) |
Uptime: | 02:13:39 |
Calls: | 335 |
Messages: | 113,421 |