sproutcore 1.6.0.beta.3 → 1.6.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +33 -0
- data/Rakefile +213 -10
- data/VERSION.yml +1 -1
- data/lib/Buildfile +5 -1
- data/lib/buildtasks/manifest.rake +7 -1
- data/lib/frameworks/sproutcore/Buildfile +3 -2
- data/lib/frameworks/sproutcore/CHANGELOG.md +154 -1
- data/lib/frameworks/sproutcore/README.md +1 -1
- data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +9 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +254 -207
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +243 -172
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +29 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +14 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +2 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +20 -12
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +61 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +20 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +42 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controls/button.js +39 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +396 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/{system → views}/bindable_span.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +78 -51
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +233 -67
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +66 -55
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +190 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +212 -182
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +23 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/alert.css +49 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/a_sample_image.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/apple-logo1.jpeg +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/iframe.html +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/disclosure.css +20 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/drag.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/icons.css +214 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/cap.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/downbutton.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-cancel-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-down-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-left-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-redo-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-right-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-tools-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-undo-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-up-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-bottom.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-center.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-top.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/track.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/upbutton.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/list_item.css +145 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu.css +10 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +88 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/modal.css +3 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/panel.css +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/picker.css +37 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +29 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/radio.css +11 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +121 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/separator.css +20 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +34 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split_divider.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/tab.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/toolbar.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/touch-scroller.css +13 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/well.css +65 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +114 -103
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +7 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/{panes → views}/select_button.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +35 -33
- data/lib/frameworks/sproutcore/frameworks/foundation/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +4 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +55 -13
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/benchmark.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/blank.gif +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/bootstrap.rhtml +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +36 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/checkbox_view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/debug/control-test-pane.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/favicon.ico +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-logo.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/inline_editor.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +47 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/radio_view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/static_layout.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +130 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +0 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +4 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/debug/monitor.js +4 -73
- data/lib/frameworks/sproutcore/frameworks/statechart/debug/sequence_matcher.js +189 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +122 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +88 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/empty_state.js +34 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/history_state.js +97 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +7 -189
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +14 -78
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/debug/sequence_matcher.js +464 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +31 -11
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/async/with_concurrent_states.js +6 -4
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/advanced.js +40 -6
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/basic.js +22 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/intermediate.js +44 -3
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +61 -9
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/additions.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/runner.css +11 -2
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/testsuite.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +66 -27
- data/lib/frameworks/sproutcore/frameworks/testing/tests/spy_on.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/testing/tests/stub_method.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +24 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/fonts.css +39 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +126 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +57 -0
- data/lib/frameworks/sproutcore/lib/index.rhtml +7 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +13 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +16 -14
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu_item.png +0 -0
- data/lib/gen/app/templates/apps/@target_name@/Buildfile +1 -4
- data/lib/gen/app/templates/apps/@target_name@/core.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/main.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/resources/main_page.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/theme.js +1 -4
- data/lib/gen/controller/templates/controllers/{@filename@.js → @filename@_controller.js} +1 -4
- data/lib/gen/controller/templates/tests/controllers/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/data-source/templates/data_sources/{@filename@.js → @filename@_data_source.js} +1 -4
- data/lib/gen/design/templates/resources/@filename@.js +1 -4
- data/lib/gen/framework/templates/frameworks/@target_name@/core.js +1 -4
- data/lib/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +1 -4
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -4
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +2 -0
- data/lib/gen/html_project/templates/@filename@/Buildfile +1 -4
- data/lib/gen/html_project/templates/@filename@/README +1 -4
- data/lib/gen/language/templates/@filename@/strings.js +1 -4
- data/lib/gen/model/templates/fixtures/{@filename@.js → @filename@_fixtures.js} +2 -5
- data/lib/gen/model/templates/models/{@filename@.js → @filename@_model.js} +1 -4
- data/lib/gen/model/templates/tests/models/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/page/templates/pages/@target_name@/Buildfile +1 -4
- data/lib/gen/page/templates/pages/@target_name@/core.js +1 -4
- data/lib/gen/page/templates/pages/@target_name@/en.lproj/strings.js +1 -4
- data/lib/gen/page/templates/pages/@target_name@/resources/body.css +3 -1
- data/lib/gen/project/templates/@filename@/Buildfile +1 -4
- data/lib/gen/project/templates/@filename@/README +1 -5
- data/lib/gen/responder/templates/states/{@filename@.js → @filename@_state.js} +1 -4
- data/lib/gen/test/templates/tests/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +1 -5
- data/lib/gen/theme/templates/themes/@target_name@/theme.js +1 -4
- data/lib/gen/view/templates/tests/views/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/view/templates/views/{@filename@.js → @filename@_view.js} +1 -4
- data/lib/sproutcore.rb +4 -1
- data/lib/sproutcore/builders/handlebars.rb +1 -1
- data/lib/sproutcore/builders/module.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +4 -2
- data/lib/sproutcore/models/generator.rb +22 -0
- data/lib/sproutcore/models/manifest_entry.rb +1 -0
- data/lib/sproutcore/models/target.rb +4 -1
- data/lib/sproutcore/rack/builder.rb +3 -0
- data/lib/sproutcore/tools.rb +11 -11
- data/lib/sproutcore/tools/init.rb +10 -22
- data/lib/sproutcore/tools/manifest.rb +21 -22
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +21 -1
- data/spec/fixtures/ordered_entries/apps/template_style/a.js +0 -0
- data/spec/fixtures/ordered_entries/apps/template_style/template_style.js +0 -0
- data/spec/lib/buildfile_commands/build_task_spec.rb +1 -1
- data/spec/lib/tools/manifest_spec.rb +11 -0
- data/sproutcore.gemspec +2 -2
- data/vendor/chance/lib/chance/instance.rb +3 -1
- metadata +118 -74
- data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/core.css +0 -378
- data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/view.css +0 -57
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +0 -56
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +0 -73
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +0 -916
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -185
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +0 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +0 -101
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -91
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +0 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +0 -10
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +0 -132
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +0 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +0 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +0 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -71
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +0 -40
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +0 -47
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +0 -146
- data/lib/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +0 -69
@@ -360,4 +360,25 @@ test("Create Parent with Broken Child Array", function(){
|
|
360
360
|
|
361
361
|
});
|
362
362
|
|
363
|
+
test("pushObject should trigger an arrayContentDidChange with only 1 added item", function() {
|
364
|
+
var didChangeCalls = [], target;
|
363
365
|
|
366
|
+
target = SC.Object.create({
|
367
|
+
willChange: function() {},
|
368
|
+
didChange: function() {
|
369
|
+
didChangeCalls.push(arguments);
|
370
|
+
}
|
371
|
+
});
|
372
|
+
|
373
|
+
testParent.get('elements').addArrayObservers({
|
374
|
+
target: target,
|
375
|
+
willChange: 'willChange',
|
376
|
+
didChange: 'didChange'
|
377
|
+
});
|
378
|
+
testParent.get('elements').pushObject({});
|
379
|
+
|
380
|
+
equals(didChangeCalls.length, 1, 'didChange should only be called once');
|
381
|
+
equals(didChangeCalls[0][0], 0, 'didChange should be called with a start index of 0 because we can\'t be sure about the order from the server');
|
382
|
+
equals(didChangeCalls[0][1], 4, 'didChange should be called with a removed count of 4');
|
383
|
+
equals(didChangeCalls[0][2], 5, 'didChange should be called with an added count of 5 because the items could have changed order on the server');
|
384
|
+
});
|
@@ -6,7 +6,7 @@
|
|
6
6
|
/*globals module ok equals same test MyApp */
|
7
7
|
|
8
8
|
// test core array-mapping methods for RecordArray with RecordAttribute
|
9
|
-
var storeKeys, rec, rec2, bar, MyApp;
|
9
|
+
var storeKeys, rec, rec2, rec3, bar, MyApp;
|
10
10
|
|
11
11
|
module("SC.RecordAttribute core methods", {
|
12
12
|
setup: function() {
|
@@ -29,6 +29,9 @@ module("SC.RecordAttribute core methods", {
|
|
29
29
|
// test mapping Date
|
30
30
|
date: SC.Record.attr(Date),
|
31
31
|
nonIsoDate: SC.Record.attr(Date, { useIsoDate: false }),
|
32
|
+
|
33
|
+
// test SC.DateTimes
|
34
|
+
dateTime: SC.Record.attr(SC.DateTime),
|
32
35
|
|
33
36
|
// test Array
|
34
37
|
anArray: SC.Record.attr(Array),
|
@@ -78,6 +81,7 @@ module("SC.RecordAttribute core methods", {
|
|
78
81
|
firstName: "John",
|
79
82
|
lastName: "Doe",
|
80
83
|
date: "2009-03-01T20:30-08:00",
|
84
|
+
dateTime: new Date(1235939425000),
|
81
85
|
anArray: ['one', 'two', 'three'],
|
82
86
|
anObject: { 'key1': 'value1', 'key2': 'value2' },
|
83
87
|
aNumber: '123',
|
@@ -90,6 +94,7 @@ module("SC.RecordAttribute core methods", {
|
|
90
94
|
lastName: "Doe",
|
91
95
|
relatedTo: 'foo1',
|
92
96
|
relatedToAggregate: 'bar1',
|
97
|
+
dateTime: "2009-03-01T20:30:25Z",
|
93
98
|
anArray: 'notAnArray',
|
94
99
|
anObject: 'notAnObject',
|
95
100
|
aNumber: '123',
|
@@ -101,6 +106,7 @@ module("SC.RecordAttribute core methods", {
|
|
101
106
|
firstName: "Alex",
|
102
107
|
lastName: "Doe",
|
103
108
|
relatedToComputed: 'bar1',
|
109
|
+
dateTime: SC.DateTime.create(1235939425000),
|
104
110
|
anArray: ['one', 'two', 'three'],
|
105
111
|
anObject: { 'key1': 'value1', 'key2': 'value2' },
|
106
112
|
aNumber: '123'
|
@@ -116,6 +122,7 @@ module("SC.RecordAttribute core methods", {
|
|
116
122
|
|
117
123
|
rec = MyApp.store.find(MyApp.Foo, 'foo1');
|
118
124
|
rec2 = MyApp.store.find(MyApp.Foo, 'foo2');
|
125
|
+
rec3 = MyApp.store.find(MyApp.Foo, 'foo3');
|
119
126
|
|
120
127
|
bar = MyApp.store.find(MyApp.Bar, 'bar1');
|
121
128
|
equals(rec.storeKey, storeKeys[0], 'should find record');
|
@@ -158,6 +165,13 @@ test("reading date should parse ISO date", function() {
|
|
158
165
|
equals(rec.get('date').toString(), d.toString(), 'should have matched date');
|
159
166
|
});
|
160
167
|
|
168
|
+
test("reading dateTime should parse ISO date", function() {
|
169
|
+
var ms = 1235939425000;
|
170
|
+
equals(rec.getPath('dateTime.milliseconds'), ms, 'should have parsed Date properly');
|
171
|
+
equals(rec2.getPath('dateTime.milliseconds'), ms, 'should have parsed String properly');
|
172
|
+
equals(rec3.getPath('dateTime.milliseconds'), ms, 'should have parsed SC.DateTime properly');
|
173
|
+
});
|
174
|
+
|
161
175
|
test("reading date should parse non-ISO date", function() {
|
162
176
|
var d = new Date(1244624150000);
|
163
177
|
equals(rec2.get('nonIsoDate').toString(), d.toString(), 'should have matched date');
|
@@ -167,7 +167,6 @@ test("calling storeDidChangeStoreKeys() with a matching recordType should not un
|
|
167
167
|
|
168
168
|
test("adding an array observer to a SC.RecordArray should cause the array to flush", function() {
|
169
169
|
var callCount = 0;
|
170
|
-
debugger;
|
171
170
|
|
172
171
|
recs.addArrayObservers({
|
173
172
|
didChange: function() {
|
@@ -7,43 +7,58 @@
|
|
7
7
|
|
8
8
|
/**
|
9
9
|
Standard error thrown by `SC.Scanner` when it runs out of bounds
|
10
|
-
|
11
|
-
@
|
10
|
+
|
11
|
+
@static
|
12
|
+
@constant
|
13
|
+
@type Error
|
12
14
|
*/
|
13
15
|
SC.SCANNER_OUT_OF_BOUNDS_ERROR = new Error("Out of bounds.");
|
14
16
|
|
15
17
|
/**
|
16
18
|
Standard error thrown by `SC.Scanner` when you pass a value not an integer.
|
17
19
|
|
18
|
-
@
|
20
|
+
@static
|
21
|
+
@constant
|
22
|
+
@type Error
|
19
23
|
*/
|
20
24
|
SC.SCANNER_INT_ERROR = new Error("Not an int.");
|
21
25
|
|
22
26
|
/**
|
23
27
|
Standard error thrown by `SC.SCanner` when it cannot find a string to skip.
|
24
28
|
|
25
|
-
@
|
29
|
+
@static
|
30
|
+
@constant
|
31
|
+
@type Error
|
26
32
|
*/
|
27
33
|
SC.SCANNER_SKIP_ERROR = new Error("Did not find the string to skip.");
|
28
34
|
|
29
35
|
/**
|
30
36
|
Standard error thrown by `SC.Scanner` when it can any kind a string in the
|
31
37
|
matching array.
|
38
|
+
|
39
|
+
@static
|
40
|
+
@constant
|
41
|
+
@type Error
|
32
42
|
*/
|
33
43
|
SC.SCANNER_SCAN_ARRAY_ERROR = new Error("Did not find any string of the given array to scan.");
|
34
44
|
|
35
45
|
/**
|
36
46
|
Standard error thrown when trying to compare two dates in different
|
37
47
|
timezones.
|
38
|
-
|
39
|
-
@
|
48
|
+
|
49
|
+
@static
|
50
|
+
@constant
|
51
|
+
@type Error
|
40
52
|
*/
|
41
53
|
SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR = new Error("Can't compare the dates of two DateTimes that don't have the same timezone.");
|
42
54
|
|
43
55
|
/**
|
44
56
|
Standard ISO8601 date format
|
45
|
-
|
46
|
-
@
|
57
|
+
|
58
|
+
@static
|
59
|
+
@type String
|
60
|
+
@default '%Y-%m-%dT%H:%M:%S%Z'
|
61
|
+
@constant
|
47
62
|
*/
|
48
63
|
SC.DATETIME_ISO8601 = '%Y-%m-%dT%H:%M:%S%Z';
|
49
64
|
|
@@ -69,8 +84,7 @@ SC.Scanner = SC.Object.extend(
|
|
69
84
|
|
70
85
|
SC.Scanner.create({string: 'May, 8th'});
|
71
86
|
|
72
|
-
@
|
73
|
-
@type {String}
|
87
|
+
@type String
|
74
88
|
*/
|
75
89
|
string: null,
|
76
90
|
|
@@ -79,8 +93,7 @@ SC.Scanner = SC.Object.extend(
|
|
79
93
|
characters are processed.
|
80
94
|
The default is 0: the beginning of the string.
|
81
95
|
|
82
|
-
@
|
83
|
-
@type {integer}
|
96
|
+
@type Integer
|
84
97
|
*/
|
85
98
|
scanLocation: 0,
|
86
99
|
|
@@ -88,9 +101,9 @@ SC.Scanner = SC.Object.extend(
|
|
88
101
|
Reads some characters from the string, and increments the scan location
|
89
102
|
accordingly.
|
90
103
|
|
91
|
-
@param {
|
92
|
-
@throws {SC.SCANNER_OUT_OF_BOUNDS_ERROR}
|
93
|
-
@returns {String}
|
104
|
+
@param {Integer} len The amount of characters to read
|
105
|
+
@throws {SC.SCANNER_OUT_OF_BOUNDS_ERROR} If asked to read too many characters
|
106
|
+
@returns {String} The characters
|
94
107
|
*/
|
95
108
|
scan: function(len) {
|
96
109
|
if (this.scanLocation + len > this.length) throw SC.SCANNER_OUT_OF_BOUNDS_ERROR;
|
@@ -102,10 +115,10 @@ SC.Scanner = SC.Object.extend(
|
|
102
115
|
/**
|
103
116
|
Reads some characters from the string and interprets it as an integer.
|
104
117
|
|
105
|
-
@param {
|
106
|
-
@param {
|
107
|
-
@throws {SC.SCANNER_INT_ERROR}
|
108
|
-
@returns {
|
118
|
+
@param {Integer} min_len The minimum amount of characters to read
|
119
|
+
@param {Integer} [max_len] The maximum amount of characters to read (defaults to the minimum)
|
120
|
+
@throws {SC.SCANNER_INT_ERROR} If asked to read non numeric characters
|
121
|
+
@returns {Integer} The scanned integer
|
109
122
|
*/
|
110
123
|
scanInt: function(min_len, max_len) {
|
111
124
|
if (max_len === undefined) max_len = min_len;
|
@@ -122,9 +135,9 @@ SC.Scanner = SC.Object.extend(
|
|
122
135
|
/**
|
123
136
|
Attempts to skip a given string.
|
124
137
|
|
125
|
-
@param {String} str
|
126
|
-
@throws {SC.SCANNER_SKIP_ERROR}
|
127
|
-
@returns {Boolean} YES if the given string was successfully scanned
|
138
|
+
@param {String} str The string to skip
|
139
|
+
@throws {SC.SCANNER_SKIP_ERROR} If the given string could not be scanned
|
140
|
+
@returns {Boolean} YES if the given string was successfully scanned, NO otherwise
|
128
141
|
*/
|
129
142
|
skipString: function(str) {
|
130
143
|
if (this.scan(str.length) !== str) throw SC.SCANNER_SKIP_ERROR;
|
@@ -135,8 +148,8 @@ SC.Scanner = SC.Object.extend(
|
|
135
148
|
Attempts to scan any string in a given array.
|
136
149
|
|
137
150
|
@param {Array} ary the array of strings to scan
|
138
|
-
@throws {SC.SCANNER_SCAN_ARRAY_ERROR}
|
139
|
-
@returns {
|
151
|
+
@throws {SC.SCANNER_SCAN_ARRAY_ERROR} If no string of the given array is found
|
152
|
+
@returns {Integer} The index of the scanned string of the given array
|
140
153
|
*/
|
141
154
|
scanArray: function(ary) {
|
142
155
|
for (var i = 0, len = ary.length; i < len; i++) {
|
@@ -189,9 +202,11 @@ SC.Scanner = SC.Object.extend(
|
|
189
202
|
@since SproutCore 1.0
|
190
203
|
*/
|
191
204
|
SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
192
|
-
|
205
|
+
/** @scope SC.DateTime.prototype */ {
|
193
206
|
|
194
|
-
/**
|
207
|
+
/**
|
208
|
+
@private
|
209
|
+
|
195
210
|
Internal representation of a date: the number of milliseconds
|
196
211
|
since January, 1st 1970 00:00:00.0 UTC.
|
197
212
|
|
@@ -199,57 +214,53 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
|
199
214
|
@type {Integer}
|
200
215
|
*/
|
201
216
|
_ms: 0,
|
202
|
-
|
217
|
+
|
203
218
|
/** @read-only
|
204
219
|
The offset, in minutes, between UTC and the object's timezone.
|
205
220
|
All calls to `get()` will use this time zone to translate date/time
|
206
221
|
values into the zone specified here.
|
207
|
-
|
208
|
-
@
|
209
|
-
@type {Integer}
|
222
|
+
|
223
|
+
@type Integer
|
210
224
|
*/
|
211
225
|
timezone: 0,
|
212
226
|
|
213
227
|
/**
|
214
|
-
A `DateTime` instance is frozen by default for better performance.
|
215
|
-
|
216
|
-
@
|
217
|
-
@type {Boolean}
|
228
|
+
A `SC.DateTime` instance is frozen by default for better performance.
|
229
|
+
|
230
|
+
@type Boolean
|
218
231
|
*/
|
219
232
|
isFrozen: YES,
|
220
|
-
|
233
|
+
|
221
234
|
/**
|
222
|
-
Returns a new `DateTime` object where one or more of the elements have been
|
235
|
+
Returns a new `SC.DateTime` object where one or more of the elements have been
|
223
236
|
changed according to the options parameter. The time options (hour,
|
224
237
|
minute, sec, usec) reset cascadingly, so if only the hour is passed, then
|
225
238
|
minute, sec, and usec is set to 0. If the hour and minute is passed, then
|
226
239
|
sec and usec is set to 0.
|
227
|
-
|
228
|
-
(Parts copied from the Ruby On Rails documentation)
|
229
|
-
|
240
|
+
|
230
241
|
If a time zone is passed in the options hash, all dates and times are assumed
|
231
|
-
to be local to it, and the returned `DateTime` instance has that time zone.
|
242
|
+
to be local to it, and the returned `SC.DateTime` instance has that time zone. If
|
232
243
|
none is passed, it defaults to `SC.DateTime.timezone`.
|
233
244
|
|
234
245
|
Note that passing only a time zone does not affect the actual milliseconds since
|
235
246
|
Jan 1, 1970, only the time zone in which it is expressed when displayed.
|
236
|
-
|
247
|
+
|
237
248
|
@see SC.DateTime#create for the list of options you can pass
|
238
|
-
@returns {DateTime} copy of receiver
|
249
|
+
@returns {SC.DateTime} copy of receiver
|
239
250
|
*/
|
240
251
|
adjust: function(options, resetCascadingly) {
|
241
252
|
var timezone;
|
242
|
-
|
253
|
+
|
243
254
|
options = options ? SC.clone(options) : {};
|
244
255
|
timezone = (options.timezone !== undefined) ? options.timezone : (this.timezone !== undefined) ? this.timezone : 0;
|
245
|
-
|
256
|
+
|
246
257
|
return this.constructor._adjust(options, this._ms, timezone, resetCascadingly)._createFromCurrentState();
|
247
258
|
},
|
248
|
-
|
259
|
+
|
249
260
|
/**
|
250
|
-
Returns a new `DateTime` object advanced according the the given parameters.
|
261
|
+
Returns a new `SC.DateTime` object advanced according the the given parameters.
|
251
262
|
Don't use floating point values, it might give unpredicatble results.
|
252
|
-
|
263
|
+
|
253
264
|
@see SC.DateTime#create for the list of options you can pass
|
254
265
|
@param {Hash} options the amount of date/time to advance the receiver
|
255
266
|
@returns {DateTime} copy of the receiver
|
@@ -257,44 +268,44 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
|
257
268
|
advance: function(options) {
|
258
269
|
return this.constructor._advance(options, this._ms, this.timezone)._createFromCurrentState();
|
259
270
|
},
|
260
|
-
|
271
|
+
|
261
272
|
/**
|
262
273
|
Generic getter.
|
263
|
-
|
274
|
+
|
264
275
|
The properties you can get are:
|
265
|
-
- `
|
266
|
-
- `
|
267
|
-
- `
|
268
|
-
- `
|
269
|
-
- `
|
270
|
-
- `
|
271
|
-
- `
|
272
|
-
- `
|
273
|
-
- `
|
276
|
+
- `year`
|
277
|
+
- `month` (January is 1, contrary to JavaScript Dates for which January is 0)
|
278
|
+
- `day`
|
279
|
+
- `dayOfWeek` (Sunday is 0)
|
280
|
+
- `hour`
|
281
|
+
- `minute`
|
282
|
+
- `second`
|
283
|
+
- `millisecond`
|
284
|
+
- `milliseconds`, the number of milliseconds since
|
274
285
|
January, 1st 1970 00:00:00.0 UTC
|
275
|
-
- `
|
286
|
+
- `isLeapYear`, a boolean value indicating whether the receiver's year
|
276
287
|
is a leap year
|
277
|
-
- `
|
278
|
-
- `
|
279
|
-
- `
|
288
|
+
- `daysInMonth`, the number of days of the receiver's current month
|
289
|
+
- `dayOfYear`, January 1st is 1, December 31th is 365 for a common year
|
290
|
+
- `week` or `week1`, the week number of the current year, starting with
|
280
291
|
the first Sunday as the first day of the first week (00..53)
|
281
|
-
- `
|
292
|
+
- `week0`, the week number of the current year, starting with
|
282
293
|
the first Monday as the first day of the first week (00..53)
|
283
|
-
- `
|
284
|
-
`
|
294
|
+
- `lastMonday`, `lastTuesday`, etc., `nextMonday`,
|
295
|
+
`nextTuesday`, etc., the date of the last or next weekday in
|
285
296
|
comparison to the receiver.
|
286
|
-
|
297
|
+
|
287
298
|
@param {String} key the property name to get
|
288
299
|
@return the value asked for
|
289
300
|
*/
|
290
301
|
unknownProperty: function(key) {
|
291
302
|
return this.constructor._get(key, this._ms, this.timezone);
|
292
303
|
},
|
293
|
-
|
304
|
+
|
294
305
|
/**
|
295
306
|
Formats the receiver according to the given format string. Should behave
|
296
307
|
like the C strftime function.
|
297
|
-
|
308
|
+
|
298
309
|
The format parameter can contain the following characters:
|
299
310
|
- %a -- The abbreviated weekday name (``Sun'')
|
300
311
|
- %A -- The full weekday name (``Sunday'')
|
@@ -326,28 +337,31 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
|
326
337
|
- %Y -- Year with century
|
327
338
|
- %Z -- Time zone (ISO 8601 formatted)
|
328
339
|
- %% -- Literal ``%'' character
|
329
|
-
|
340
|
+
|
330
341
|
@param {String} format the format string
|
331
342
|
@return {String} the formatted string
|
332
343
|
*/
|
333
344
|
toFormattedString: function(fmt) {
|
334
345
|
return this.constructor._toFormattedString(fmt, this._ms, this.timezone);
|
335
346
|
},
|
336
|
-
|
347
|
+
|
337
348
|
/**
|
338
349
|
Formats the receiver according ISO 8601 standard. It is equivalent to
|
339
350
|
calling toFormattedString with the `'%Y-%m-%dT%H:%M:%S%Z'` format string.
|
340
|
-
|
351
|
+
|
341
352
|
@return {String} the formatted string
|
342
353
|
*/
|
343
354
|
toISO8601: function(){
|
344
355
|
return this.constructor._toFormattedString(SC.DATETIME_ISO8601, this._ms, this.timezone);
|
345
356
|
},
|
346
|
-
|
347
|
-
/**
|
357
|
+
|
358
|
+
/**
|
359
|
+
@private
|
360
|
+
|
348
361
|
Creates a string representation of the receiver.
|
362
|
+
|
349
363
|
(Debuggers often call the `toString` method. Because of the way
|
350
|
-
`DateTime` is designed, calling `SC.DateTime._toFormattedString` would
|
364
|
+
`SC.DateTime` is designed, calling `SC.DateTime._toFormattedString` would
|
351
365
|
have a nasty side effect. We shouldn't therefore call any of
|
352
366
|
`SC.DateTime`'s methods from `toString`)
|
353
367
|
|
@@ -361,10 +375,10 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
|
361
375
|
},
|
362
376
|
|
363
377
|
/**
|
364
|
-
Returns `YES` if the passed `DateTime` is equal to the receiver, ie: if their
|
378
|
+
Returns `YES` if the passed `SC.DateTime` is equal to the receiver, ie: if their
|
365
379
|
number of milliseconds since January, 1st 1970 00:00:00.0 UTC are equal.
|
366
380
|
This is the preferred method for testing equality.
|
367
|
-
|
381
|
+
|
368
382
|
@see SC.DateTime#compare
|
369
383
|
@param {SC.DateTime} aDateTime the DateTime to compare to
|
370
384
|
@returns {Boolean}
|
@@ -372,12 +386,12 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
|
372
386
|
isEqual: function(aDateTime) {
|
373
387
|
return SC.DateTime.compare(this, aDateTime) === 0;
|
374
388
|
},
|
375
|
-
|
389
|
+
|
376
390
|
/**
|
377
|
-
Returns a copy of the receiver. Because of the way `DateTime` is designed,
|
391
|
+
Returns a copy of the receiver. Because of the way `SC.DateTime` is designed,
|
378
392
|
it just returns the receiver.
|
379
|
-
|
380
|
-
@returns {DateTime}
|
393
|
+
|
394
|
+
@returns {SC.DateTime}
|
381
395
|
*/
|
382
396
|
copy: function() {
|
383
397
|
return this;
|
@@ -387,15 +401,15 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
|
387
401
|
Returns a copy of the receiver with the timezone set to the passed
|
388
402
|
timezone. The returned value is equal to the receiver (ie `SC.Compare`
|
389
403
|
returns 0), it is just the timezone representation that changes.
|
390
|
-
|
404
|
+
|
391
405
|
If you don't pass any argument, the target timezone is assumed to be 0,
|
392
406
|
ie UTC.
|
393
407
|
|
394
408
|
Note that this method does not change the underlying position in time,
|
395
|
-
but only the time zone in which it is displayed.
|
409
|
+
but only the time zone in which it is displayed. In other words, the underlying
|
396
410
|
number of milliseconds since Jan 1, 1970 does not change.
|
397
|
-
|
398
|
-
@return {DateTime}
|
411
|
+
|
412
|
+
@return {SC.DateTime}
|
399
413
|
*/
|
400
414
|
toTimezone: function(timezone) {
|
401
415
|
if (timezone === undefined) timezone = 0;
|
@@ -404,127 +418,130 @@ SC.DateTime = SC.Object.extend(SC.Freezable, SC.Copyable,
|
|
404
418
|
|
405
419
|
});
|
406
420
|
|
407
|
-
// Class Methods
|
408
421
|
SC.DateTime.mixin(SC.Comparable,
|
409
|
-
|
410
|
-
|
422
|
+
/** @scope SC.DateTime */ {
|
423
|
+
|
411
424
|
/**
|
412
425
|
The default format (ISO 8601) in which DateTimes are stored in a record.
|
413
426
|
Change this value if your backend sends and receives dates in another
|
414
427
|
format.
|
415
|
-
|
428
|
+
|
416
429
|
This value can also be customized on a per-attribute basis with the format
|
417
430
|
property. For example:
|
418
|
-
|
431
|
+
|
419
432
|
SC.Record.attr(SC.DateTime, { format: '%d/%m/%Y %H:%M:%S' })
|
420
|
-
|
421
|
-
@
|
422
|
-
@
|
433
|
+
|
434
|
+
@type String
|
435
|
+
@default SC.DATETIME_ISO8601
|
423
436
|
*/
|
424
437
|
recordFormat: SC.DATETIME_ISO8601,
|
425
|
-
|
438
|
+
|
426
439
|
/**
|
427
|
-
@
|
428
|
-
@type {Array}
|
440
|
+
@type Array
|
429
441
|
@default ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
430
442
|
*/
|
431
443
|
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
432
444
|
|
433
|
-
/**
|
434
|
-
|
435
|
-
'nextTuesday', etc., getters.
|
445
|
+
/**
|
446
|
+
@private
|
436
447
|
|
437
|
-
|
438
|
-
|
448
|
+
The English day names used for the 'lastMonday', 'nextTuesday', etc., getters.
|
449
|
+
|
450
|
+
@type Array
|
439
451
|
*/
|
440
452
|
_englishDayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
441
453
|
|
442
454
|
/**
|
443
|
-
@
|
444
|
-
@type {Array}
|
455
|
+
@type Array
|
445
456
|
@default ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
446
457
|
*/
|
447
458
|
abbreviatedDayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
448
459
|
|
449
460
|
/**
|
450
|
-
@
|
451
|
-
@type {Array}
|
461
|
+
@type Array
|
452
462
|
@default ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
453
463
|
*/
|
454
464
|
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
455
465
|
|
456
466
|
/**
|
457
|
-
@
|
458
|
-
@type {Array}
|
467
|
+
@type Array
|
459
468
|
@default ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
460
469
|
*/
|
461
470
|
abbreviatedMonthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
462
471
|
|
463
|
-
/**
|
472
|
+
/**
|
473
|
+
@private
|
474
|
+
|
464
475
|
The unique internal `Date` object used to make computations. Better
|
465
476
|
performance is obtained by having only one Date object for the whole
|
466
477
|
application and manipulating it with `setTime()` and `getTime()`.
|
467
|
-
|
478
|
+
|
468
479
|
Note that since this is used for internal calculations across many
|
469
|
-
`DateTime` instances, it is not guaranteed to store the date/time that
|
470
|
-
any one `DateTime` instance represents. So it might be that
|
480
|
+
`SC.DateTime` instances, it is not guaranteed to store the date/time that
|
481
|
+
any one `SC.DateTime` instance represents. So it might be that
|
471
482
|
|
472
483
|
this._date.getTime() !== this._ms
|
473
484
|
|
474
485
|
Be sure to set it before using for internal calculations if necessary.
|
475
486
|
|
476
|
-
@
|
477
|
-
@type {Date}
|
487
|
+
@type Date
|
478
488
|
*/
|
479
489
|
_date: new Date(),
|
480
|
-
|
481
|
-
/**
|
490
|
+
|
491
|
+
/**
|
492
|
+
@private
|
493
|
+
|
482
494
|
The offset, in minutes, between UTC and the currently manipulated
|
483
|
-
DateTime instance.
|
484
|
-
|
485
|
-
@
|
486
|
-
@type {Integer}
|
495
|
+
`SC.DateTime` instance.
|
496
|
+
|
497
|
+
@type Integer
|
487
498
|
*/
|
488
499
|
_tz: 0,
|
489
500
|
|
490
501
|
/**
|
491
502
|
The offset, in minutes, between UTC and the local system time. This
|
492
503
|
property is computed at loading time and should never be changed.
|
493
|
-
|
494
|
-
@
|
495
|
-
@
|
504
|
+
|
505
|
+
@type Integer
|
506
|
+
@default new Date().getTimezoneOffset()
|
507
|
+
@constant
|
496
508
|
*/
|
497
509
|
timezone: new Date().getTimezoneOffset(),
|
498
510
|
|
499
|
-
/**
|
500
|
-
|
511
|
+
/**
|
512
|
+
@private
|
513
|
+
|
514
|
+
A cache of `SC.DateTime` instances. If you attempt to create a `SC.DateTime`
|
501
515
|
instance that has already been created, then it will return the cached
|
502
516
|
value.
|
503
517
|
|
504
|
-
@
|
505
|
-
@type {Array}
|
518
|
+
@type Array
|
506
519
|
*/
|
507
520
|
_dt_cache: {},
|
508
521
|
|
509
|
-
/**
|
522
|
+
/**
|
523
|
+
@private
|
524
|
+
|
510
525
|
The index of the lastest cached value. Used with `_DT_CACHE_MAX_LENGTH` to
|
511
526
|
limit the size of the cache.
|
512
527
|
|
513
|
-
@
|
514
|
-
@type {Integer}
|
528
|
+
@type Integer
|
515
529
|
*/
|
516
530
|
_dt_cache_index: -1,
|
517
|
-
|
518
|
-
/**
|
531
|
+
|
532
|
+
/**
|
533
|
+
@private
|
534
|
+
|
519
535
|
The maximum length of `_dt_cache`. If this limit is reached, then the cache
|
520
536
|
is overwritten, starting with the oldest element.
|
521
537
|
|
522
|
-
@
|
523
|
-
@type {Integer}
|
538
|
+
@type Integer
|
524
539
|
*/
|
525
540
|
_DT_CACHE_MAX_LENGTH: 1000,
|
526
541
|
|
527
|
-
/**
|
542
|
+
/**
|
543
|
+
@private
|
544
|
+
|
528
545
|
Both args are optional, but will only overwrite `_date` and `_tz` if
|
529
546
|
defined. This method does not affect the DateTime instance's actual time,
|
530
547
|
but simply initializes the one `_date` instance to a time relevant for a
|
@@ -552,6 +569,8 @@ SC.DateTime.mixin(SC.Comparable,
|
|
552
569
|
},
|
553
570
|
|
554
571
|
/**
|
572
|
+
@private
|
573
|
+
|
555
574
|
By this time, any time zone setting on 'hash' will be ignored.
|
556
575
|
'timezone' will be used, or the last this._tz.
|
557
576
|
*/
|
@@ -561,7 +580,8 @@ SC.DateTime.mixin(SC.Comparable,
|
|
561
580
|
return this._setCalcState(ms, tz); // now call the one we really wanted
|
562
581
|
},
|
563
582
|
|
564
|
-
/**
|
583
|
+
/**
|
584
|
+
@private
|
565
585
|
@see SC.DateTime#unknownProperty
|
566
586
|
*/
|
567
587
|
_get: function(key, start, timezone) {
|
@@ -588,7 +608,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
588
608
|
else if (key === 'timezone') {
|
589
609
|
v = this._tz;
|
590
610
|
}
|
591
|
-
|
611
|
+
|
592
612
|
// 'nextWeekday' or 'lastWeekday'.
|
593
613
|
// We want to do this calculation in local time, before shifting UTC below.
|
594
614
|
if (v === null) {
|
@@ -606,7 +626,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
606
626
|
}
|
607
627
|
}
|
608
628
|
}
|
609
|
-
|
629
|
+
|
610
630
|
if (v === null) {
|
611
631
|
// need to adjust for alternate display time zone.
|
612
632
|
// Before calculating, we need to get everything into a common time zone to
|
@@ -614,7 +634,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
614
634
|
if (timezone !== undefined) {
|
615
635
|
this._setCalcState(d.getTime() - (timezone * 60000), 0); // make this instance's time zone the new UTC temporarily
|
616
636
|
}
|
617
|
-
|
637
|
+
|
618
638
|
// simple keys
|
619
639
|
switch (key) {
|
620
640
|
case 'year':
|
@@ -642,7 +662,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
642
662
|
v = d.getUTCMilliseconds();
|
643
663
|
break;
|
644
664
|
}
|
645
|
-
|
665
|
+
|
646
666
|
// isLeapYear
|
647
667
|
if ((v === null) && (key === 'isLeapYear')) {
|
648
668
|
y = this._get('year');
|
@@ -666,7 +686,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
666
686
|
break;
|
667
687
|
}
|
668
688
|
}
|
669
|
-
|
689
|
+
|
670
690
|
// dayOfYear
|
671
691
|
if ((v === null) && (key === 'dayOfYear')) {
|
672
692
|
ms = d.getTime(); // save time
|
@@ -703,6 +723,8 @@ SC.DateTime.mixin(SC.Comparable,
|
|
703
723
|
},
|
704
724
|
|
705
725
|
/**
|
726
|
+
@private
|
727
|
+
|
706
728
|
Sets the internal calculation state to something specified.
|
707
729
|
*/
|
708
730
|
_adjust: function(options, start, timezone, resetCascadingly) {
|
@@ -712,7 +734,8 @@ SC.DateTime.mixin(SC.Comparable,
|
|
712
734
|
return this; // for chaining
|
713
735
|
},
|
714
736
|
|
715
|
-
/**
|
737
|
+
/**
|
738
|
+
@private
|
716
739
|
@see SC.DateTime#advance
|
717
740
|
*/
|
718
741
|
_advance: function(options, start, timezone) {
|
@@ -722,7 +745,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
722
745
|
for (var key in opts) {
|
723
746
|
opts[key] += this._get(key, start, timezone);
|
724
747
|
}
|
725
|
-
|
748
|
+
|
726
749
|
// The time zone can be advanced by a delta as well, so try to use the
|
727
750
|
// new value if there is one.
|
728
751
|
tz = (opts.timezone !== undefined) ? opts.timezone : timezone; // watch out for zero, which is acceptable as a time zone
|
@@ -730,7 +753,9 @@ SC.DateTime.mixin(SC.Comparable,
|
|
730
753
|
return this._adjust(opts, start, tz, NO);
|
731
754
|
},
|
732
755
|
|
733
|
-
/*
|
756
|
+
/*
|
757
|
+
@private
|
758
|
+
|
734
759
|
Converts a standard date/time options hash to an integer representing that position
|
735
760
|
in time relative to Jan 1, 1970
|
736
761
|
*/
|
@@ -747,18 +772,18 @@ SC.DateTime.mixin(SC.Comparable,
|
|
747
772
|
if (!SC.none(start)) {
|
748
773
|
d.setTime(start); // using milliseconds here specifies an absolute location in time, regardless of time zone, so that's nice
|
749
774
|
}
|
750
|
-
|
775
|
+
|
751
776
|
// We have to get all time expressions, both in 'options' (assume to be in time zone 'timezone')
|
752
777
|
// and in 'd', to the same time zone before we can any calculations correctly. So because the Date object provides
|
753
778
|
// a suite of UTC getters and setters, we'll temporarily redefine 'timezone' as our new
|
754
779
|
// 'UTC', so we don't have to worry about local machine time. We do this by subtracting
|
755
780
|
// milliseconds for the time zone offset. Then we'll do all our calculations, then convert
|
756
781
|
// it back to real UTC.
|
757
|
-
|
782
|
+
|
758
783
|
// (Zero time zone is considered a valid value.)
|
759
784
|
tz = (timezone !== undefined) ? timezone : (this.timezone !== undefined) ? this.timezone : 0;
|
760
785
|
d.setTime(d.getTime() - (tz * 60000)); // redefine 'UTC' to establish a new local absolute so we can use all the 'getUTC...()' Date methods
|
761
|
-
|
786
|
+
|
762
787
|
// the time options (hour, minute, sec, millisecond)
|
763
788
|
// reset cascadingly (see documentation)
|
764
789
|
if (resetCascadingly === undefined || resetCascadingly === YES) {
|
@@ -774,7 +799,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
774
799
|
opts.millisecond = 0;
|
775
800
|
}
|
776
801
|
}
|
777
|
-
|
802
|
+
|
778
803
|
// Get the current values for any not provided in the options hash.
|
779
804
|
// Since everything is in 'UTC' now, use the UTC accessors. We do this because,
|
780
805
|
// according to javascript Date spec, you have to set year, month, and day together
|
@@ -805,35 +830,35 @@ SC.DateTime.mixin(SC.Comparable,
|
|
805
830
|
|
806
831
|
return ms;
|
807
832
|
},
|
808
|
-
|
833
|
+
|
809
834
|
/**
|
810
|
-
Returns a new DateTime object advanced according the the given parameters.
|
835
|
+
Returns a new `SC.DateTime` object advanced according the the given parameters.
|
811
836
|
The parameters can be:
|
812
|
-
|
813
|
-
- none, to create a DateTime instance initialized to the current
|
837
|
+
|
838
|
+
- none, to create a `SC.DateTime` instance initialized to the current
|
814
839
|
date and time in the local timezone,
|
815
840
|
- a integer, the number of milliseconds since
|
816
841
|
January, 1st 1970 00:00:00.0 UTC
|
817
842
|
- a options hash that can contain any of the following properties: year,
|
818
843
|
month, day, hour, minute, second, millisecond, timezone
|
819
|
-
|
844
|
+
|
820
845
|
Note that if you attempt to create a `SC.DateTime` instance that has already
|
821
846
|
been created, then, for performance reasons, a cached value may be
|
822
847
|
returned.
|
823
|
-
|
848
|
+
|
824
849
|
The timezone option is the offset, in minutes, between UTC and local time.
|
825
850
|
If you don't pass a timezone option, the date object is created in the
|
826
851
|
local timezone. If you want to create a UTC+2 (CEST) date, for example,
|
827
852
|
then you should pass a timezone of -120.
|
828
|
-
|
853
|
+
|
829
854
|
@param options one of the three kind of parameters descibed above
|
830
|
-
@returns {DateTime} the DateTime instance that corresponds to the
|
855
|
+
@returns {SC.DateTime} the SC.DateTime instance that corresponds to the
|
831
856
|
passed parameters, possibly fetched from cache
|
832
857
|
*/
|
833
858
|
create: function() {
|
834
859
|
var arg = arguments.length === 0 ? {} : arguments[0];
|
835
860
|
var timezone;
|
836
|
-
|
861
|
+
|
837
862
|
// if simply milliseconds since Jan 1, 1970 are given, just use those
|
838
863
|
if (SC.typeOf(arg) === SC.T_NUMBER) {
|
839
864
|
arg = { milliseconds: arg };
|
@@ -871,10 +896,12 @@ SC.DateTime.mixin(SC.Comparable,
|
|
871
896
|
}
|
872
897
|
},
|
873
898
|
|
874
|
-
/**
|
899
|
+
/**
|
900
|
+
@private
|
901
|
+
|
875
902
|
Calls the `create()` method with the current internal `_date` value.
|
876
|
-
|
877
|
-
@return {DateTime} the DateTime instance returned by create()
|
903
|
+
|
904
|
+
@return {SC.DateTime} the SC.DateTime instance returned by create()
|
878
905
|
*/
|
879
906
|
_createFromCurrentState: function() {
|
880
907
|
return this.create({
|
@@ -884,7 +911,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
884
911
|
},
|
885
912
|
|
886
913
|
/**
|
887
|
-
Returns a `DateTime` object created from a given string parsed with a given
|
914
|
+
Returns a `SC.DateTime` object created from a given string parsed with a given
|
888
915
|
format. Returns `null` if the parsing fails.
|
889
916
|
|
890
917
|
@see SC.DateTime#toFormattedString for a description of the format parameter
|
@@ -897,9 +924,9 @@ SC.DateTime.mixin(SC.Comparable,
|
|
897
924
|
// retains state across function calls
|
898
925
|
var re = new RegExp('(?:%([aAbBcdDhHiIjmMpsSUWwxXyYZ%])|(.))', "g");
|
899
926
|
var d, parts, opts = {}, check = {}, scanner = SC.Scanner.create({string: str});
|
900
|
-
|
927
|
+
|
901
928
|
if (SC.none(fmt)) fmt = SC.DATETIME_ISO8601;
|
902
|
-
|
929
|
+
|
903
930
|
try {
|
904
931
|
while ((parts = re.exec(fmt)) !== null) {
|
905
932
|
switch(parts[1]) {
|
@@ -946,37 +973,40 @@ SC.DateTime.mixin(SC.Comparable,
|
|
946
973
|
SC.Logger.log('SC.DateTime.createFromString ' + e.toString());
|
947
974
|
return null;
|
948
975
|
}
|
949
|
-
|
976
|
+
|
950
977
|
if (!SC.none(opts.meridian) && !SC.none(opts.hour)) {
|
951
978
|
if (opts.meridian === 1) opts.hour = (opts.hour + 12) % 24;
|
952
979
|
delete opts.meridian;
|
953
980
|
}
|
954
|
-
|
981
|
+
|
955
982
|
d = SC.DateTime.create(opts);
|
956
|
-
|
983
|
+
|
957
984
|
if (!SC.none(check.dayOfWeek) && d.get('dayOfWeek') !== check.dayOfWeek) {
|
958
985
|
return null;
|
959
986
|
}
|
960
|
-
|
987
|
+
|
961
988
|
return d;
|
962
989
|
},
|
963
|
-
|
964
|
-
/**
|
990
|
+
|
991
|
+
/**
|
992
|
+
@private
|
993
|
+
|
965
994
|
Converts the x parameter into a string padded with 0s so that the string’s
|
966
995
|
length is at least equal to the len parameter.
|
967
996
|
|
968
|
-
@param x the object to convert to a string
|
997
|
+
@param {Object} x the object to convert to a string
|
969
998
|
@param {Integer} the minimum length of the returned string
|
970
999
|
@returns {String} the padded string
|
971
1000
|
*/
|
972
1001
|
_pad: function(x, len) {
|
973
|
-
|
974
|
-
|
1002
|
+
var str = '' + x;
|
1003
|
+
if (len === undefined) len = 2;
|
975
1004
|
while (str.length < len) str = '0' + str;
|
976
1005
|
return str;
|
977
1006
|
},
|
978
|
-
|
979
|
-
/**
|
1007
|
+
|
1008
|
+
/**
|
1009
|
+
@private
|
980
1010
|
@see SC.DateTime#_toFormattedString
|
981
1011
|
*/
|
982
1012
|
__toFormattedString: function(part, start, timezone) {
|
@@ -989,7 +1019,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
989
1019
|
// This method is simply a helper for this._toFormattedString() (one underscore);
|
990
1020
|
// this is only called from there, and _toFormattedString() has already
|
991
1021
|
// set up the appropriate internal date/time/timezone state for it.
|
992
|
-
|
1022
|
+
|
993
1023
|
switch(part[1]) {
|
994
1024
|
case 'a': return this.abbreviatedDayNames[this._get('dayOfWeek')];
|
995
1025
|
case 'A': return this.dayNames[this._get('dayOfWeek')];
|
@@ -1029,8 +1059,9 @@ SC.DateTime.mixin(SC.Comparable,
|
|
1029
1059
|
case '%': return '%';
|
1030
1060
|
}
|
1031
1061
|
},
|
1032
|
-
|
1033
|
-
/**
|
1062
|
+
|
1063
|
+
/**
|
1064
|
+
@private
|
1034
1065
|
@see SC.DateTime#toFormattedString
|
1035
1066
|
*/
|
1036
1067
|
_toFormattedString: function(format, start, timezone) {
|
@@ -1045,12 +1076,12 @@ SC.DateTime.mixin(SC.Comparable,
|
|
1045
1076
|
return v;
|
1046
1077
|
});
|
1047
1078
|
},
|
1048
|
-
|
1079
|
+
|
1049
1080
|
/**
|
1050
1081
|
This will tell you which of the two passed `DateTime` is greater by
|
1051
1082
|
comparing their number of milliseconds since
|
1052
1083
|
January, 1st 1970 00:00:00.0 UTC.
|
1053
|
-
|
1084
|
+
|
1054
1085
|
@param {SC.DateTime} a the first DateTime instance
|
1055
1086
|
@param {SC.DateTime} b the second DateTime instance
|
1056
1087
|
@returns {Integer} -1 if a < b,
|
@@ -1062,12 +1093,12 @@ SC.DateTime.mixin(SC.Comparable,
|
|
1062
1093
|
var mb = b.get('milliseconds');
|
1063
1094
|
return ma < mb ? -1 : ma === mb ? 0 : 1;
|
1064
1095
|
},
|
1065
|
-
|
1096
|
+
|
1066
1097
|
/**
|
1067
1098
|
This will tell you which of the two passed DateTime is greater
|
1068
1099
|
by only comparing the date parts of the passed objects. Only dates
|
1069
1100
|
with the same timezone can be compared.
|
1070
|
-
|
1101
|
+
|
1071
1102
|
@param {SC.DateTime} a the first DateTime instance
|
1072
1103
|
@param {SC.DateTime} b the second DateTime instance
|
1073
1104
|
@returns {Integer} -1 if a < b,
|
@@ -1082,13 +1113,12 @@ SC.DateTime.mixin(SC.Comparable,
|
|
1082
1113
|
var mb = b.adjust({hour: 0}).get('milliseconds');
|
1083
1114
|
return ma < mb ? -1 : ma === mb ? 0 : 1;
|
1084
1115
|
}
|
1085
|
-
|
1116
|
+
|
1086
1117
|
});
|
1087
1118
|
|
1088
1119
|
/**
|
1089
1120
|
Adds a transform to format the DateTime value to a String value according
|
1090
|
-
to the passed format string.
|
1091
|
-
|
1121
|
+
to the passed format string.
|
1092
1122
|
|
1093
1123
|
valueBinding: SC.Binding.dateTime('%Y-%m-%d %H:%M:%S')
|
1094
1124
|
.from('MyApp.myController.myDateTime');
|