Skip to content

Instantly share code, notes, and snippets.

@ColinCampbell
Created April 4, 2011 20:31
Show Gist options
  • Select an option

  • Save ColinCampbell/902365 to your computer and use it in GitHub Desktop.

Select an option

Save ColinCampbell/902365 to your computer and use it in GitHub Desktop.
diff --git a/Buildfile b/Buildfile
index 7336ba3..bedf185 100644
--- a/Buildfile
+++ b/Buildfile
@@ -30,9 +30,10 @@ config :bootstrap, :required => [], :use_modules => false
config :jquery, :required => []
config :handlebars, :required => []
config :runtime, :required => [:jquery]
-config :datetime, :required => [:runtime]
+config :'datetime/core', :required => [:runtime]
+config :datetime, :required => [:'datetime/core']
config :core_foundation, :required => [:runtime, :handlebars]
-config :foundation, :required => [:core_foundation, :datetime]
+config :foundation, :required => [:core_foundation, :datetime, :'datetime/localized']
config :datastore, :required => [:runtime, :datetime]
config :desktop, :required => [:foundation]
config :media, :required => [:desktop]
diff --git a/frameworks/datetime/frameworks/core/system/datetime.js b/frameworks/datetime/frameworks/core/system/datetime.js
index 9e265a3..1a72574 100644
--- a/frameworks/datetime/frameworks/core/system/datetime.js
+++ b/frameworks/datetime/frameworks/core/system/datetime.js
@@ -422,16 +422,11 @@ SC.DateTime.mixin(SC.Comparable,
recordFormat: SC.DATETIME_ISO8601,
/**
- The localized day names. Add the key '_SC.DateTime.dayNames' and its value
- to your strings.js file to add support for another language than English.
-
- Default is evaluated on the document.ready event.
-
@property
@type {Array}
- @default '_SC.DateTime.dayNames'.loc().w()
+ @default ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
*/
- dayNames: null,
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
/** @private
The English day names used for the 'lastMonday',
@@ -443,43 +438,25 @@ SC.DateTime.mixin(SC.Comparable,
_englishDayNames: 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.w(),
/**
- The localized abbreviated day names. Add the key
- '_SC.DateTime.abbreviatedDayNames' and its value to your strings.js
- file to add support for another language than English.
-
- Default is evaluated on the document.ready event.
-
@property
@type {Array}
- @default '_SC.DateTime.abbreviatedDayNames'.loc().w()
+ @default ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
*/
- abbreviatedDayNames: null,
+ abbreviatedDayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
/**
- The localized month names. Add the key '_SC.DateTime.monthNames' and its
- value to your strings.js file to add support for another language than
- English.
-
- Default is evaluated on the document.ready event.
-
@property
@type {Array}
- @default '_SC.DateTime.monthNames'.loc().w()
+ @default ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
*/
- monthNames: null,
+ monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
/**
- The localized abbreviated month names. Add the key
- '_SC.DateTime.abbreviatedMonthNames' and its value to your strings.js
- file to add support for another language than English.
-
- Default is evaluated on the document.ready event.
-
@property
@type {Array}
- @default '_SC.DateTime.abbreviatedMonthNames'.loc().w()
+ @default ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
*/
- abbreviatedMonthNames: null,
+ abbreviatedMonthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
/** @private
The unique internal Date object used to make computations. Better
@@ -546,30 +523,6 @@ SC.DateTime.mixin(SC.Comparable,
_DT_CACHE_MAX_LENGTH: 1000,
/** @private
- Called on document.ready.
-
- Because localizations may have been modified by an application developer,
- we need to wait for the ready event to actually evaluate the localizations.
- */
- _setup: function() {
- if (!SC.DateTime.dayNames) {
- SC.DateTime.dayNames = '_SC.DateTime.dayNames'.loc().w();
- }
-
- if (!SC.DateTime.abbreviatedDayNames) {
- SC.DateTime.abbreviatedDayNames = '_SC.DateTime.abbreviatedDayNames'.loc().w();
- }
-
- if (!SC.DateTime.monthNames) {
- SC.DateTime.monthNames = '_SC.DateTime.monthNames'.loc().w();
- }
-
- if (!SC.DateTime.abbreviatedMonthNames) {
- SC.DateTime.abbreviatedMonthNames = '_SC.DateTime.abbreviatedMonthNames'.loc().w();
- }
- },
-
- /** @private
Both args are optional, but will only overwrite _date and _tz if defined.
This method does not affect the DateTime instance's actual time, but simply
initializes the one _date instance to a time relevant for a calculation.
@@ -1146,7 +1099,3 @@ SC.Binding.dateTime = function(format) {
return value ? value.toFormattedString(format) : null;
});
};
-
-jQuery(document).ready(function() {
- SC.DateTime._setup();
-});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment