pixel9/mathjs — pull request #8 by CraigCav (2014-06-18 22:36:29+00:00)
Title: Date math

build on top of PR https://github.com/pixel9/mathjs/pull/7

When passing parameters to custom functions (such as TEXT()), mathjs will call `valueOf()` on each parameter before calling `function.apply()`. This means that any function implementation cannot use type information to determine the correct processing (calling `saleforceDate.valueof()` will return a decimal - thereby making it impossible for TEXT to special case the handling of date fields).

Changes
--------------
Only call `valueof` when there is no `value` field. This allows the salesforceDate object to be passed to TEXT remaining untouched, whilst still maintaining the expected behavior for other mathjs apis.