FixDates Recursion Example

An example for Fixing Dates within objects recursively, for Stack Overflow question: http://stackoverflow.com/questions/10884813/what-is-the-best-way-to-handle-time-zones-with-javascript

JavaScript

/* var app = window.app = $.extend(true, {}, app, {
        // Creating a namespace for my app which is safe across multiple files.
        ajax: function (options) {
            var defaultSettings = {
                type: 'POST',
                async: true
            };

            // Capture the settings.
            var settings = $.extend(true, {}, defaultSettings, options);
            
            // Install our general handlers;
            if (settings.success) {
                settings.success = function (data, textStatus, jqXHR) {
                    app.OnPostSuccess(data, textStatus, jqXHR, options.success);
                }
            } else 
                settings.success = app.OnPostSuccess;
                
            if (settings.error) {
                settings.error = function (jqXHR, ajaxSettings, thrownError) {
                    app.OnPostError(event, jqXHR, ajaxSettings, thrownError, options.error);
                }
            } else
                settings.error = app.OnPostError;

            $.ajax(settings);
        },
        OnPostSuccess: function (data, textStatus, jqXHR, fn_after) {
            // Do my generalized success handling here.
            
            // Fix Dates.
            var fixedData = app.FixDate(data);
            
            // Call any other handler that's been specified.
            if (typeof fn_after === 'function')
                fn_after(fixedData, textStatus, jqXHR);
        },
        OnPostError: function (jqXHR, ajaxSettings, thrownError, fn_after) {
            // Do my generalized error handling here.
            
            // Call any other handler that's been specified.
            if (typeof fn_after === 'function')
                fn_after(jqXHR, ajaxSettings, thrownError);
        },
        FixDate: function (obj) {
            var fixed = obj;

            if (typeof obj == 'string' && obj.indexOf('\/Date(') == 0) {
                // Microsoft date "/Date(12345678)/" -...