Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add support for Cordova Globalization API #720

Closed
wants to merge 1 commit into from

2 participants

@gtanner

This commit adds support for feature #686.

All of the mobile-spec tests are now passing and unit tests cover
most of the code.

Most of the settings are via the device panel with some interesting
workarounds:

  • no timezone support (just returns ??? for the timezone, we can fix this later if someone wants it)
  • DayLight savings time is handled via a checkbox in the device settings, if checked all dates are returned as isDST
  • All number and currency formatting is hardcoded to be North American. (can be controlled via the accountingjs if needed)
@gtanner gtanner Add support for Cordova Globalization API
This commit adds support for feature #686.

All of the mobile-spec tests are now passing and unit tests cover
most of the code.

Most of the settings are via the device panel with some interesting
workarounds:

- no timezone support (just returns ??? for the timezone, we can fix
  this later if someone wants it)
- DayLight savings time is handled via a checkbox in the device
  settings, if checked all dates are returned as isDST
- All number and currency formatting is hardcoded to be North American.
  (can be controlled via the accountingjs if needed)
e9f2e9a
@gtanner gtanner commented on the diff
...client/platform/cordova/2.0.0/bridge/globalization.js
((166 lines not shown))
+ },
+
+ getDateNames: function (win, fail, args) {
+ var options = args[0].options || {},
+ type = options.type || 'wide',
+ item = options.item || 'months',
+ key = item;
+
+ if (key === 'days') key = 'weekdays';
+ if (type === 'narrow') key += 'Short';
+
+
+ //HACK: The mobile-spec tests use instanceof checks for Array
+ // We need to make sure we use the same prototype hash
+ // as the frame's window so that test works.
+ win({value: new bridge.window().Array().concat(moment[key])});
@gtanner
gtanner added a note

This is an interesting hack and might be something we add to utils.

This solves the problem where instanceof would fail for some of our types (since they are created in the other frame)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@brentlintner

Looks good to me (+1). Did a brief overlook. Awesome about the in depth unit tests + higher level mobile spec passing. Stuff like that just makes you feel so good inside, you know.

@gtanner

Yeah, @brentlintner. On the whole, it felt really good. I will merge this into next once the OSS license stuff clears up internally

@gtanner

Merged

@gtanner gtanner closed this
@gtanner gtanner deleted the cordova.globalization branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2013
  1. @gtanner

    Add support for Cordova Globalization API

    gtanner authored
    This commit adds support for feature #686.
    
    All of the mobile-spec tests are now passing and unit tests cover
    most of the code.
    
    Most of the settings are via the device panel with some interesting
    workarounds:
    
    - no timezone support (just returns ??? for the timezone, we can fix
      this later if someone wants it)
    - DayLight savings time is handled via a checkbox in the device
      settings, if checked all dates are returned as isDST
    - All number and currency formatting is hardcoded to be North American.
      (can be controlled via the accountingjs if needed)
Something went wrong with that request. Please try again.