Decimal commas vs. decimal points (and a few dashes of thousands separators)

so, i believe that the official stance on this is probably still

i assume that the big majority of bees uses decimal points instead of decimal commas, and this is such a minor nitpick that even i understand it’s not worth the coding effort to have an either/or option (or to automatically change it based on region, or whatever else would be easiest)—at least not compared to other feature requests!

i just wanted to throw my hat in the ring for this as well, specifically for making decimal commas valid in browsers. (the android app, at least for me, automatically opens a numeric keypad that only has a decimal point as an option, so there’s not much room for confusion/annoyance.) (there’s a thread focused on an old, long-resolved ios bug, that for a while made entering decimal numbers basically impossible: Trying to make a point. or: You must have too many stickers)

my main reason for wanting a decimal-comma-option (on the browser interface): the layout of the numeric keypad on german keyboards. there’s no . there for me to press next to the numbers. i have to go a bit to the left to press the regular . key if i want to use a decimal point. (there’s a , on the bottom of the numeric keypad, though, because we use decimal commas. right within reach of all the numbers!)
image of a german keyboard to illustrate my description (i will say that the distance between the . key and the numeric keypad for me personally is a bit shorter than it is in the image, because all keys are more compressed on laptop keyboards. it’s still a significant difference, though, given that the decimal comma is right there on the numeric keypad.)

also (vaguely) related: thousands separators!

i care way less for this than for the decimal-separator-discussion, but i do think that eventually having thousands separators would be neat! i assume that everyone’s steps goals regularly suprass 1 000 steps/day, and it would absolutely be neat to more easily see at a glance if yesterday’s steps were 1 500 or 15 000! but since, out of all my six current goals, my steps goal is the only one to regularly exceed 1 000, and since it’s never bothered me too much (i usually look directly into the garmin app to see my steps count, or on my watch), i feel like having thousands separators would merely be a nice, visual perk. no practical advantage for me here like there would be with the decimal commas.
if a thousands separators option is ever implement, i’d appreciate it if “blank” was an option as well, instead of the (probably more common?) comma or point. (so “1 000” like i wrote above, instead of “1,000” or “1.000”.) it might be personal preference or confusion with regards to decimal separators°, but i think i’d prefer it like this! (especially since the problem of blanks creating line breaks, which might be an issue here in forum posts, wouldn’t be one in beeminder, i think‽)
°how i learned it: decimal commas; points as thousands separators. / how the majority of the internet learned it (usa etc.): decimal points; commas as thousands separators.—i think i can deal well with switching/remembering one version (whether it’s mine or “the other one”) when it just comes to the decimal values. having to also think about the thousands separator as something either similar and/or different from what i’m used / from the decimal separator system, sounds like too much mental gymnastics XD hence my personal preference for the blank!

sorry for creating yet another topic about this! but it somehow didn’t really feel right to add this rambling to either one of the two or three topics that already mention decimal separators. (which are also all at least 3 years old.) if someone disagrees, though, feel free to move this post to one of them!

2 Likes

The neat thing about the web is that is extremely customizable; though the chance of Beeminder ever supporting decimal commas is very low indeed, on the web you can just write your own user script or browser extension.

You can “monkeypatch” Beeminder’s javascript: go look through their front-end code with the browser’s dev tools, find the function you want to modify, save a copy of the original version in a variable, then write your own version that reformats the data before calling the saved version of the function.

I make absolutely no guarantees about the following code which I threw together with a few minutes of poking around; it’s the simplest thing that could possibly work, munging the data with regexes, rather than code that is particularly maintainable or robust. You can use it as a starting point; I’m giving it merely as an example of the kind of thing you could do:

const originalAddDatapoint = beemApi.addDatapoint

beemApi.addDatapoint = function(slug, { urtext }, ...args) {
    const dayOfMonth = $("form.add-data-form .add-data-date").val()

    const urtextWithoutDay = urtext.replace(dayOfMonth + ' ', '')

    const [, value, comment] = urtextWithoutDay.match(/([^ ]*)(.*)/)

    const formattedValue = value.replace(',', '.')

    const newUrtext = dayOfMonth + ' ' + formattedValue + comment

    return originalAddDatapoint.call(this, slug, { urtext: newUrtext }, ...args)
}

This monkeypatches the addDatapoint function, with the replace(',', '.') line doing the actual work and the rest just disassembling the urtext string which is the concatenation of the date, value, and comment. Used as a userscript, it would make Beeminder see decimal points where the you enter decimal commas, meaning that you get to enter datapoints in the format you like, and Beeminder sees them in the format it accepts.

The point isn’t limited to these specific lines of code, of course—rather, I encourage having a mindset in which one realizes that websites can be customized to work the way you like, even if it isn’t something the website owners feel inclined to do.

2 Likes

thank you so much for this (both the general reminder and the code)!

unfortunately, i have absolutely zero coding-knowledge, so this isn’t something i could just play around with for a bit until it works. (well, i think we did a bit of html in school once, but that’s obviously not useful in this case.)
fortunately, i have friends who will be able to help me, so we should be able to figure something out if your code doesn’t already work.

2 Likes

Same, I don’t like it when beeminder rejects my commas :frowning:

2 Likes