Skip to content

Commit

Permalink
closes #34; timestamps not encoded properly
Browse files Browse the repository at this point in the history
NOTE: timestamps, dates, and times are converted to numbers in FileMaker's
own internal number format. This is useful for parsing within FileMaker,
but not useful for interacting with other services that expect a standard
format like YYYY-MM-DD.
Currently, you must manually convert timestamps, dates, and times to
whatever standard format you need, if sending the JSON to a different
system that expects a particular format.
  • Loading branch information
dansmith65 committed Oct 5, 2015
1 parent 78dd22b commit 57e2311
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Binary file modified FMFiles/FileMaker-JSON-Functions.fmp12
Binary file not shown.
18 changes: 12 additions & 6 deletions Functions/z_jsonEncodeSupport.fmfn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* LINK: https://github.com/dansmith65/FileMaker-JSON-Functions
*
* HISTORY:
* MODIFIED on 2015-OCT-05 by Daniel Smith dansmith65@gmail.com
* - convert to number before encoding as number; fixes bug #34
* v1.0.0 RELEASED on 2015-APR-27 by Daniel Smith dansmith65@gmail.com
* =====================================
*/
Expand Down Expand Up @@ -160,14 +162,18 @@ Case (
* =====================================
*/

Case (
Left ( req ; 2 ) = "-." ;
Substitute ( req ; "-." ; "-0." ) ;
Let ( [
~num = GetAsNumber ( req )
] ;
Case (
Left ( ~num ; 2 ) = "-." ;
Substitute ( ~num ; "-." ; "-0." ) ;

Left ( req ; 1 ) = "." ;
"0" & req ;
Left ( ~num ; 1 ) = "." ;
"0" & ~num ;

req
~num
)
) ;


Expand Down

0 comments on commit 57e2311

Please sign in to comment.