Archive for the ‘number formatting’ tag
The project is called flexible-js-formatting and includes my fast,flexible formatting and parsing functions for dates, times and numbers. As a bonus, I threw in the code for the Date Chooser and the HTML Input Mask, so pretty much everything is there.
All you need to do is grab a copy of the Subversion repository and hack to your heart’s content. One person has already contributed some work to reorganize the files and add some of his own patches.
If you’re looking to make the code better, you can scan the comments on my old posts for user-suggested improvements that never made it into the code.
I originally started this post in May of 2006, intending to use the libraries to demonstrate how HTML tables can contain multi-dimensional data, and use the seldom-used HTML elements like
TFOOT to generate aggregate data about the table. This was going to be the follow-up to my tables and data with CSS post. I had a rough draft sketched out somewhere: a table full of numbers, dates, currencies and strings. A drop-down menu and a “format paintbrush” would let you reformat it all on the fly, and it would all be generated from semantic information attached to the table cells, not hard-coded into the page.
This was only practical because of the efficiency of my libraries; to reformat entire date regions in the table in real-time, for example, you’d need to parse the value as a date in one format, then reformat it for output in another. It was to be a showcase of how much efficiency matters for some things.
Tangent: I suppose it’s less important for people who aren’t still running 500MHz laptops these days, but efficiency really matters for me; a lot of these flashy sites these days simply take too much CPU for my little old computer to run well. I stubbornly resist getting a new computer because I cringe at the thought of the environmental cost, but I’m slowly breaking down; it’s gotten to the point my battery won’t charge, and Dell doesn’t even have a record of my service tag anymore. Spare parts for these things are long since unavailable.
Who knows — someday I may end up building some browser GUI systems again and use these. In the meantime it’s encouraging that they remain useful to people.
Note: This episode is pre-recorded. I’m taking a short hiatus from blogging and will respond to your comments when I return.