extjs-rails 4.1.0.alpha5 → 4.1.0.alpha6
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/extjs-rails.js +95613 -11000
- data/lib/extjs-rails/version.rb +1 -1
- metadata +2 -509
- data/app/assets/javascripts/src/AbstractComponent.js +0 -3290
- data/app/assets/javascripts/src/AbstractManager.js +0 -144
- data/app/assets/javascripts/src/AbstractPlugin.js +0 -72
- data/app/assets/javascripts/src/Action.js +0 -276
- data/app/assets/javascripts/src/Ajax.js +0 -99
- data/app/assets/javascripts/src/Component.js +0 -1344
- data/app/assets/javascripts/src/ComponentLoader.js +0 -202
- data/app/assets/javascripts/src/ComponentManager.js +0 -47
- data/app/assets/javascripts/src/ComponentQuery.js +0 -521
- data/app/assets/javascripts/src/Editor.js +0 -494
- data/app/assets/javascripts/src/ElementLoader.js +0 -404
- data/app/assets/javascripts/src/FocusManager.js +0 -712
- data/app/assets/javascripts/src/Img.js +0 -111
- data/app/assets/javascripts/src/Layer.js +0 -543
- data/app/assets/javascripts/src/LoadMask.js +0 -432
- data/app/assets/javascripts/src/ModelManager.js +0 -186
- data/app/assets/javascripts/src/PluginManager.js +0 -110
- data/app/assets/javascripts/src/ProgressBar.js +0 -336
- data/app/assets/javascripts/src/Shadow.js +0 -233
- data/app/assets/javascripts/src/ShadowPool.js +0 -43
- data/app/assets/javascripts/src/Template.js +0 -331
- data/app/assets/javascripts/src/XTemplate.js +0 -365
- data/app/assets/javascripts/src/XTemplateCompiler.js +0 -450
- data/app/assets/javascripts/src/XTemplateParser.js +0 -249
- data/app/assets/javascripts/src/ZIndexManager.js +0 -519
- data/app/assets/javascripts/src/app/Application.js +0 -271
- data/app/assets/javascripts/src/app/Controller.js +0 -458
- data/app/assets/javascripts/src/app/EventBus.js +0 -112
- data/app/assets/javascripts/src/button/Button.js +0 -1483
- data/app/assets/javascripts/src/button/Cycle.js +0 -215
- data/app/assets/javascripts/src/button/Split.js +0 -99
- data/app/assets/javascripts/src/chart/Callout.js +0 -140
- data/app/assets/javascripts/src/chart/Chart.js +0 -966
- data/app/assets/javascripts/src/chart/Highlight.js +0 -172
- data/app/assets/javascripts/src/chart/Label.js +0 -241
- data/app/assets/javascripts/src/chart/Legend.js +0 -474
- data/app/assets/javascripts/src/chart/LegendItem.js +0 -217
- data/app/assets/javascripts/src/chart/Mask.js +0 -230
- data/app/assets/javascripts/src/chart/MaskLayer.js +0 -48
- data/app/assets/javascripts/src/chart/Navigation.js +0 -79
- data/app/assets/javascripts/src/chart/Shape.js +0 -106
- data/app/assets/javascripts/src/chart/Tip.js +0 -98
- data/app/assets/javascripts/src/chart/TipSurface.js +0 -42
- data/app/assets/javascripts/src/chart/axis/Abstract.js +0 -73
- data/app/assets/javascripts/src/chart/axis/Axis.js +0 -961
- data/app/assets/javascripts/src/chart/axis/Category.js +0 -130
- data/app/assets/javascripts/src/chart/axis/Gauge.js +0 -203
- data/app/assets/javascripts/src/chart/axis/Numeric.js +0 -235
- data/app/assets/javascripts/src/chart/axis/Radial.js +0 -204
- data/app/assets/javascripts/src/chart/axis/Time.js +0 -135
- data/app/assets/javascripts/src/chart/series/Area.js +0 -803
- data/app/assets/javascripts/src/chart/series/Bar.js +0 -853
- data/app/assets/javascripts/src/chart/series/Cartesian.js +0 -328
- data/app/assets/javascripts/src/chart/series/Column.js +0 -104
- data/app/assets/javascripts/src/chart/series/Gauge.js +0 -490
- data/app/assets/javascripts/src/chart/series/Line.js +0 -1104
- data/app/assets/javascripts/src/chart/series/Pie.js +0 -1072
- data/app/assets/javascripts/src/chart/series/Radar.js +0 -440
- data/app/assets/javascripts/src/chart/series/Scatter.js +0 -668
- data/app/assets/javascripts/src/chart/series/Series.js +0 -443
- data/app/assets/javascripts/src/chart/theme/Base.js +0 -175
- data/app/assets/javascripts/src/chart/theme/Theme.js +0 -253
- data/app/assets/javascripts/src/container/AbstractContainer.js +0 -1062
- data/app/assets/javascripts/src/container/ButtonGroup.js +0 -143
- data/app/assets/javascripts/src/container/Container.js +0 -212
- data/app/assets/javascripts/src/container/DockingContainer.js +0 -265
- data/app/assets/javascripts/src/container/Viewport.js +0 -184
- data/app/assets/javascripts/src/core/dom/Element.form.js +0 -50
- data/app/assets/javascripts/src/core/dom/Element.static-more.js +0 -159
- data/app/assets/javascripts/src/core/examples/index.html +0 -321
- data/app/assets/javascripts/src/core/examples/index.js +0 -6
- data/app/assets/javascripts/src/core/examples/src/Sample/CTO.js +0 -25
- data/app/assets/javascripts/src/core/examples/src/Sample/CoolGuy.js +0 -20
- data/app/assets/javascripts/src/core/examples/src/Sample/Developer.js +0 -43
- data/app/assets/javascripts/src/core/examples/src/Sample/Gun.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/HumanResource.js +0 -23
- data/app/assets/javascripts/src/core/examples/src/Sample/Musician.js +0 -20
- data/app/assets/javascripts/src/core/examples/src/Sample/Person.js +0 -50
- data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanComposeSongs.js +0 -9
- data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanPlayGuitar.js +0 -9
- data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanSing.js +0 -18
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/A.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/B.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/C.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/D.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/E.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/A.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/B.js +0 -4
- data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/C.js +0 -3
- data/app/assets/javascripts/src/core/src/EventManager.js +0 -1167
- data/app/assets/javascripts/src/core/src/EventObject.js +0 -883
- data/app/assets/javascripts/src/core/src/Ext-more.js +0 -1283
- data/app/assets/javascripts/src/core/src/Ext.js +0 -736
- data/app/assets/javascripts/src/core/src/Support.js +0 -662
- data/app/assets/javascripts/src/core/src/class/Base.js +0 -1085
- data/app/assets/javascripts/src/core/src/class/Class.js +0 -676
- data/app/assets/javascripts/src/core/src/class/ClassManager.js +0 -1591
- data/app/assets/javascripts/src/core/src/class/Loader.js +0 -1423
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.alignment.js +0 -173
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.insertion.js +0 -193
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.js +0 -681
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.position.js +0 -356
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.static.js +0 -474
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.style.js +0 -851
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.traversal.js +0 -180
- data/app/assets/javascripts/src/core/src/dom/AbstractHelper.js +0 -291
- data/app/assets/javascripts/src/core/src/dom/AbstractQuery.js +0 -72
- data/app/assets/javascripts/src/core/src/dom/CompositeElement.js +0 -75
- data/app/assets/javascripts/src/core/src/dom/CompositeElementLite.js +0 -436
- data/app/assets/javascripts/src/core/src/dom/DomQuery-aria.js +0 -1049
- data/app/assets/javascripts/src/core/src/env/Browser.js +0 -186
- data/app/assets/javascripts/src/core/src/env/FeatureDetector.js +0 -274
- data/app/assets/javascripts/src/core/src/env/OS.js +0 -141
- data/app/assets/javascripts/src/core/src/lang/Array.js +0 -1205
- data/app/assets/javascripts/src/core/src/lang/Date.js +0 -1463
- data/app/assets/javascripts/src/core/src/lang/Error.js +0 -326
- data/app/assets/javascripts/src/core/src/lang/Function.js +0 -485
- data/app/assets/javascripts/src/core/src/lang/Number.js +0 -175
- data/app/assets/javascripts/src/core/src/lang/Object.js +0 -606
- data/app/assets/javascripts/src/core/src/lang/String.js +0 -333
- data/app/assets/javascripts/src/core/src/misc/JSON.js +0 -236
- data/app/assets/javascripts/src/core/src/perf/Accumulator.js +0 -244
- data/app/assets/javascripts/src/core/src/perf/Monitor.js +0 -197
- data/app/assets/javascripts/src/core/src/util/DelayedTask.js +0 -71
- data/app/assets/javascripts/src/core/src/util/Event.js +0 -215
- data/app/assets/javascripts/src/core/src/util/Format.js +0 -551
- data/app/assets/javascripts/src/core/src/util/TaskManager.js +0 -417
- data/app/assets/javascripts/src/core/src/version/Version.js +0 -364
- data/app/assets/javascripts/src/core/test/unit/README.MD +0 -91
- data/app/assets/javascripts/src/core/test/unit/bootstrap.js +0 -39
- data/app/assets/javascripts/src/core/test/unit/build/build-data.js +0 -34
- data/app/assets/javascripts/src/core/test/unit/build/build.sh +0 -2
- data/app/assets/javascripts/src/core/test/unit/data.js +0 -27
- data/app/assets/javascripts/src/core/test/unit/index.html +0 -15
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom.html +0 -40
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/extjs-api.js +0 -12
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/platform-api.js +0 -134
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/sanity.js +0 -4
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/touch-api-out.js +0 -128
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/touch-api.js +0 -89
- data/app/assets/javascripts/src/core/test/unit/other_specs/env/Environment.js +0 -357
- data/app/assets/javascripts/src/core/test/unit/resources/APITest.js +0 -37
- data/app/assets/javascripts/src/core/test/unit/resources/jsb3.js +0 -14
- data/app/assets/javascripts/src/core/test/unit/resources/test-setup.js +0 -137
- data/app/assets/javascripts/src/core/test/unit/spec/EventManager.js +0 -629
- data/app/assets/javascripts/src/core/test/unit/spec/Ext-mess.backup +0 -198
- data/app/assets/javascripts/src/core/test/unit/spec/Ext-more.js +0 -520
- data/app/assets/javascripts/src/core/test/unit/spec/Ext.js +0 -1550
- data/app/assets/javascripts/src/core/test/unit/spec/Support.js +0 -250
- data/app/assets/javascripts/src/core/test/unit/spec/class/Base.js +0 -47
- data/app/assets/javascripts/src/core/test/unit/spec/class/Class.js +0 -561
- data/app/assets/javascripts/src/core/test/unit/spec/class/ClassManager.js +0 -555
- data/app/assets/javascripts/src/core/test/unit/spec/dom/CompositeElementLite.js +0 -409
- data/app/assets/javascripts/src/core/test/unit/spec/dom/DomHelper.js +0 -444
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.insertion.js +0 -342
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.js +0 -731
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.static.js +0 -201
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.style.js +0 -118
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.traversal.js +0 -336
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Array.js +0 -1229
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Date.js +0 -697
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Error.js +0 -277
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Function.js +0 -536
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Number.js +0 -323
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Object.js +0 -591
- data/app/assets/javascripts/src/core/test/unit/spec/lang/String.js +0 -451
- data/app/assets/javascripts/src/core/test/unit/spec/misc/JSON.js +0 -252
- data/app/assets/javascripts/src/core/test/unit/spec/util/Format.js +0 -521
- data/app/assets/javascripts/src/core/test/unit/spec/version/Version.js +0 -148
- data/app/assets/javascripts/src/core/test/unit/specs.html +0 -19
- data/app/assets/javascripts/src/data/AbstractStore.js +0 -887
- data/app/assets/javascripts/src/data/ArrayStore.js +0 -74
- data/app/assets/javascripts/src/data/Batch.js +0 -236
- data/app/assets/javascripts/src/data/BufferStore.js +0 -13
- data/app/assets/javascripts/src/data/Connection.js +0 -969
- data/app/assets/javascripts/src/data/DirectStore.js +0 -50
- data/app/assets/javascripts/src/data/Errors.js +0 -52
- data/app/assets/javascripts/src/data/Field.js +0 -341
- data/app/assets/javascripts/src/data/IdGenerator.js +0 -198
- data/app/assets/javascripts/src/data/JsonP.js +0 -253
- data/app/assets/javascripts/src/data/JsonPStore.js +0 -51
- data/app/assets/javascripts/src/data/JsonStore.js +0 -60
- data/app/assets/javascripts/src/data/Model.js +0 -1673
- data/app/assets/javascripts/src/data/NodeInterface.js +0 -1294
- data/app/assets/javascripts/src/data/NodeStore.js +0 -254
- data/app/assets/javascripts/src/data/Operation.js +0 -331
- data/app/assets/javascripts/src/data/Request.js +0 -40
- data/app/assets/javascripts/src/data/ResultSet.js +0 -56
- data/app/assets/javascripts/src/data/SequentialIdGenerator.js +0 -61
- data/app/assets/javascripts/src/data/SortTypes.js +0 -125
- data/app/assets/javascripts/src/data/Store.js +0 -2609
- data/app/assets/javascripts/src/data/StoreManager.js +0 -156
- data/app/assets/javascripts/src/data/Tree.js +0 -290
- data/app/assets/javascripts/src/data/TreeStore.js +0 -655
- data/app/assets/javascripts/src/data/Types.js +0 -190
- data/app/assets/javascripts/src/data/UuidGenerator.js +0 -215
- data/app/assets/javascripts/src/data/XmlStore.js +0 -76
- data/app/assets/javascripts/src/data/association/Association.js +0 -243
- data/app/assets/javascripts/src/data/association/BelongsTo.js +0 -291
- data/app/assets/javascripts/src/data/association/HasMany.js +0 -289
- data/app/assets/javascripts/src/data/association/HasOne.js +0 -304
- data/app/assets/javascripts/src/data/proxy/Ajax.js +0 -282
- data/app/assets/javascripts/src/data/proxy/Client.js +0 -21
- data/app/assets/javascripts/src/data/proxy/Direct.js +0 -181
- data/app/assets/javascripts/src/data/proxy/JsonP.js +0 -313
- data/app/assets/javascripts/src/data/proxy/LocalStorage.js +0 -69
- data/app/assets/javascripts/src/data/proxy/Memory.js +0 -156
- data/app/assets/javascripts/src/data/proxy/Proxy.js +0 -433
- data/app/assets/javascripts/src/data/proxy/Rest.js +0 -173
- data/app/assets/javascripts/src/data/proxy/Server.js +0 -460
- data/app/assets/javascripts/src/data/proxy/SessionStorage.js +0 -39
- data/app/assets/javascripts/src/data/proxy/WebStorage.js +0 -546
- data/app/assets/javascripts/src/data/reader/Array.js +0 -68
- data/app/assets/javascripts/src/data/reader/Json.js +0 -383
- data/app/assets/javascripts/src/data/reader/Reader.js +0 -735
- data/app/assets/javascripts/src/data/reader/Xml.js +0 -292
- data/app/assets/javascripts/src/data/validations.js +0 -149
- data/app/assets/javascripts/src/data/writer/Json.js +0 -81
- data/app/assets/javascripts/src/data/writer/Writer.js +0 -147
- data/app/assets/javascripts/src/data/writer/Xml.js +0 -88
- data/app/assets/javascripts/src/dd/DD.js +0 -300
- data/app/assets/javascripts/src/dd/DDProxy.js +0 -204
- data/app/assets/javascripts/src/dd/DDTarget.js +0 -171
- data/app/assets/javascripts/src/dd/DragDrop.js +0 -1101
- data/app/assets/javascripts/src/dd/DragDropManager.js +0 -1264
- data/app/assets/javascripts/src/dd/DragSource.js +0 -392
- data/app/assets/javascripts/src/dd/DragTracker.js +0 -562
- data/app/assets/javascripts/src/dd/DragZone.js +0 -137
- data/app/assets/javascripts/src/dd/DropTarget.js +0 -118
- data/app/assets/javascripts/src/dd/DropZone.js +0 -254
- data/app/assets/javascripts/src/dd/Registry.js +0 -117
- data/app/assets/javascripts/src/dd/ScrollManager.js +0 -218
- data/app/assets/javascripts/src/dd/StatusProxy.js +0 -179
- data/app/assets/javascripts/src/diag/layout/Context.js +0 -523
- data/app/assets/javascripts/src/diag/layout/ContextItem.js +0 -179
- data/app/assets/javascripts/src/direct/Event.js +0 -35
- data/app/assets/javascripts/src/direct/ExceptionEvent.js +0 -16
- data/app/assets/javascripts/src/direct/JsonProvider.js +0 -82
- data/app/assets/javascripts/src/direct/Manager.js +0 -263
- data/app/assets/javascripts/src/direct/PollingProvider.js +0 -156
- data/app/assets/javascripts/src/direct/Provider.js +0 -96
- data/app/assets/javascripts/src/direct/RemotingEvent.js +0 -24
- data/app/assets/javascripts/src/direct/RemotingMethod.js +0 -100
- data/app/assets/javascripts/src/direct/RemotingProvider.js +0 -510
- data/app/assets/javascripts/src/direct/Transaction.js +0 -41
- data/app/assets/javascripts/src/dom/Element.alignment.js +0 -378
- data/app/assets/javascripts/src/dom/Element.anim.js +0 -962
- data/app/assets/javascripts/src/dom/Element.dd.js +0 -40
- data/app/assets/javascripts/src/dom/Element.fx.js +0 -194
- data/app/assets/javascripts/src/dom/Element.js +0 -1407
- data/app/assets/javascripts/src/dom/Element.position.js +0 -501
- data/app/assets/javascripts/src/dom/Element.scroll.js +0 -214
- data/app/assets/javascripts/src/dom/Element.style.js +0 -792
- data/app/assets/javascripts/src/dom/Element.traversal.js +0 -8
- data/app/assets/javascripts/src/dom/Helper.js +0 -466
- data/app/assets/javascripts/src/dom/Query.js +0 -1067
- data/app/assets/javascripts/src/draw/Color.js +0 -303
- data/app/assets/javascripts/src/draw/Component.js +0 -245
- data/app/assets/javascripts/src/draw/CompositeSprite.js +0 -299
- data/app/assets/javascripts/src/draw/Draw.js +0 -1217
- data/app/assets/javascripts/src/draw/Matrix.js +0 -183
- data/app/assets/javascripts/src/draw/Sprite.js +0 -554
- data/app/assets/javascripts/src/draw/SpriteDD.js +0 -87
- data/app/assets/javascripts/src/draw/Surface.js +0 -1001
- data/app/assets/javascripts/src/draw/Text.js +0 -175
- data/app/assets/javascripts/src/draw/engine/ImageExporter.js +0 -106
- data/app/assets/javascripts/src/draw/engine/Svg.js +0 -734
- data/app/assets/javascripts/src/draw/engine/SvgExporter.js +0 -280
- data/app/assets/javascripts/src/draw/engine/Vml.js +0 -916
- data/app/assets/javascripts/src/flash/Component.js +0 -248
- data/app/assets/javascripts/src/form/Basic.js +0 -1018
- data/app/assets/javascripts/src/form/CheckboxGroup.js +0 -441
- data/app/assets/javascripts/src/form/CheckboxManager.js +0 -26
- data/app/assets/javascripts/src/form/FieldAncestor.js +0 -210
- data/app/assets/javascripts/src/form/FieldContainer.js +0 -290
- data/app/assets/javascripts/src/form/FieldSet.js +0 -506
- data/app/assets/javascripts/src/form/Label.js +0 -110
- data/app/assets/javascripts/src/form/Labelable.js +0 -764
- data/app/assets/javascripts/src/form/Panel.js +0 -335
- data/app/assets/javascripts/src/form/RadioGroup.js +0 -124
- data/app/assets/javascripts/src/form/RadioManager.js +0 -26
- data/app/assets/javascripts/src/form/action/Action.js +0 -307
- data/app/assets/javascripts/src/form/action/DirectLoad.js +0 -107
- data/app/assets/javascripts/src/form/action/DirectSubmit.js +0 -119
- data/app/assets/javascripts/src/form/action/Load.js +0 -120
- data/app/assets/javascripts/src/form/action/StandardSubmit.js +0 -34
- data/app/assets/javascripts/src/form/action/Submit.js +0 -257
- data/app/assets/javascripts/src/form/field/Base.js +0 -813
- data/app/assets/javascripts/src/form/field/Checkbox.js +0 -505
- data/app/assets/javascripts/src/form/field/ComboBox.js +0 -1427
- data/app/assets/javascripts/src/form/field/Date.js +0 -578
- data/app/assets/javascripts/src/form/field/Display.js +0 -155
- data/app/assets/javascripts/src/form/field/Field.js +0 -430
- data/app/assets/javascripts/src/form/field/File.js +0 -265
- data/app/assets/javascripts/src/form/field/Hidden.js +0 -75
- data/app/assets/javascripts/src/form/field/HtmlEditor.js +0 -1439
- data/app/assets/javascripts/src/form/field/Number.js +0 -380
- data/app/assets/javascripts/src/form/field/Picker.js +0 -321
- data/app/assets/javascripts/src/form/field/Radio.js +0 -279
- data/app/assets/javascripts/src/form/field/Spinner.js +0 -321
- data/app/assets/javascripts/src/form/field/Text.js +0 -727
- data/app/assets/javascripts/src/form/field/TextArea.js +0 -228
- data/app/assets/javascripts/src/form/field/Time.js +0 -459
- data/app/assets/javascripts/src/form/field/Trigger.js +0 -469
- data/app/assets/javascripts/src/form/field/VTypes.js +0 -172
- data/app/assets/javascripts/src/fx/Anim.js +0 -472
- data/app/assets/javascripts/src/fx/Animator.js +0 -410
- data/app/assets/javascripts/src/fx/CubicBezier.js +0 -77
- data/app/assets/javascripts/src/fx/Easing.js +0 -136
- data/app/assets/javascripts/src/fx/Manager.js +0 -353
- data/app/assets/javascripts/src/fx/PropertyHandler.js +0 -381
- data/app/assets/javascripts/src/fx/Queue.js +0 -123
- data/app/assets/javascripts/src/fx/target/Component.js +0 -118
- data/app/assets/javascripts/src/fx/target/CompositeElement.js +0 -46
- data/app/assets/javascripts/src/fx/target/CompositeElementCSS.js +0 -22
- data/app/assets/javascripts/src/fx/target/CompositeSprite.js +0 -34
- data/app/assets/javascripts/src/fx/target/Element.js +0 -83
- data/app/assets/javascripts/src/fx/target/ElementCSS.js +0 -77
- data/app/assets/javascripts/src/fx/target/Sprite.js +0 -128
- data/app/assets/javascripts/src/fx/target/Target.js +0 -36
- data/app/assets/javascripts/src/grid/CellEditor.js +0 -172
- data/app/assets/javascripts/src/grid/ColumnComponentLayout.js +0 -34
- data/app/assets/javascripts/src/grid/ColumnLayout.js +0 -201
- data/app/assets/javascripts/src/grid/Lockable.js +0 -863
- data/app/assets/javascripts/src/grid/LockingView.js +0 -169
- data/app/assets/javascripts/src/grid/PagingScroller.js +0 -539
- data/app/assets/javascripts/src/grid/Panel.js +0 -393
- data/app/assets/javascripts/src/grid/RowEditor.js +0 -731
- data/app/assets/javascripts/src/grid/RowNumberer.js +0 -76
- data/app/assets/javascripts/src/grid/Scroller.js +0 -5
- data/app/assets/javascripts/src/grid/View.js +0 -44
- data/app/assets/javascripts/src/grid/ViewDropZone.js +0 -41
- data/app/assets/javascripts/src/grid/column/Action.js +0 -318
- data/app/assets/javascripts/src/grid/column/Boolean.js +0 -82
- data/app/assets/javascripts/src/grid/column/Column.js +0 -835
- data/app/assets/javascripts/src/grid/column/Date.js +0 -63
- data/app/assets/javascripts/src/grid/column/Number.js +0 -52
- data/app/assets/javascripts/src/grid/column/Template.js +0 -58
- data/app/assets/javascripts/src/grid/feature/AbstractSummary.js +0 -154
- data/app/assets/javascripts/src/grid/feature/Chunking.js +0 -77
- data/app/assets/javascripts/src/grid/feature/Feature.js +0 -158
- data/app/assets/javascripts/src/grid/feature/Grouping.js +0 -822
- data/app/assets/javascripts/src/grid/feature/GroupingSummary.js +0 -243
- data/app/assets/javascripts/src/grid/feature/RowBody.js +0 -116
- data/app/assets/javascripts/src/grid/feature/RowWrap.js +0 -120
- data/app/assets/javascripts/src/grid/feature/Summary.js +0 -167
- data/app/assets/javascripts/src/grid/header/Container.js +0 -965
- data/app/assets/javascripts/src/grid/header/DragZone.js +0 -69
- data/app/assets/javascripts/src/grid/header/DropZone.js +0 -265
- data/app/assets/javascripts/src/grid/plugin/CellEditing.js +0 -453
- data/app/assets/javascripts/src/grid/plugin/DragDrop.js +0 -254
- data/app/assets/javascripts/src/grid/plugin/Editing.js +0 -561
- data/app/assets/javascripts/src/grid/plugin/HeaderReorderer.js +0 -49
- data/app/assets/javascripts/src/grid/plugin/HeaderResizer.js +0 -292
- data/app/assets/javascripts/src/grid/plugin/RowEditing.js +0 -339
- data/app/assets/javascripts/src/grid/property/Grid.js +0 -351
- data/app/assets/javascripts/src/grid/property/HeaderContainer.js +0 -109
- data/app/assets/javascripts/src/grid/property/Property.js +0 -36
- data/app/assets/javascripts/src/grid/property/Store.js +0 -141
- data/app/assets/javascripts/src/layout/ClassList.js +0 -90
- data/app/assets/javascripts/src/layout/Context.js +0 -1232
- data/app/assets/javascripts/src/layout/ContextItem.js +0 -1470
- data/app/assets/javascripts/src/layout/Layout.js +0 -761
- data/app/assets/javascripts/src/layout/component/Auto.js +0 -220
- data/app/assets/javascripts/src/layout/component/Body.js +0 -80
- data/app/assets/javascripts/src/layout/component/BoundList.js +0 -95
- data/app/assets/javascripts/src/layout/component/Button.js +0 -261
- data/app/assets/javascripts/src/layout/component/Component.js +0 -427
- data/app/assets/javascripts/src/layout/component/Dock.js +0 -1132
- data/app/assets/javascripts/src/layout/component/Draw.js +0 -79
- data/app/assets/javascripts/src/layout/component/FieldSet.js +0 -62
- data/app/assets/javascripts/src/layout/component/ProgressBar.js +0 -54
- data/app/assets/javascripts/src/layout/component/Tab.js +0 -23
- data/app/assets/javascripts/src/layout/component/field/ComboBox.js +0 -52
- data/app/assets/javascripts/src/layout/component/field/Field.js +0 -372
- data/app/assets/javascripts/src/layout/component/field/FieldContainer.js +0 -48
- data/app/assets/javascripts/src/layout/component/field/HtmlEditor.js +0 -54
- data/app/assets/javascripts/src/layout/component/field/Slider.js +0 -58
- data/app/assets/javascripts/src/layout/component/field/Text.js +0 -75
- data/app/assets/javascripts/src/layout/component/field/TextArea.js +0 -51
- data/app/assets/javascripts/src/layout/component/field/Trigger.js +0 -132
- data/app/assets/javascripts/src/layout/container/Absolute.js +0 -121
- data/app/assets/javascripts/src/layout/container/Accordion.js +0 -308
- data/app/assets/javascripts/src/layout/container/Anchor.js +0 -403
- data/app/assets/javascripts/src/layout/container/Auto.js +0 -70
- data/app/assets/javascripts/src/layout/container/Border-old-js +0 -1079
- data/app/assets/javascripts/src/layout/container/Border.js +0 -816
- data/app/assets/javascripts/src/layout/container/Box.js +0 -929
- data/app/assets/javascripts/src/layout/container/Card.js +0 -361
- data/app/assets/javascripts/src/layout/container/CheckboxGroup.js +0 -376
- data/app/assets/javascripts/src/layout/container/Column.js +0 -234
- data/app/assets/javascripts/src/layout/container/Container.js +0 -961
- data/app/assets/javascripts/src/layout/container/Editor.js +0 -74
- data/app/assets/javascripts/src/layout/container/Fit.js +0 -287
- data/app/assets/javascripts/src/layout/container/Form.js +0 -157
- data/app/assets/javascripts/src/layout/container/HBox.js +0 -134
- data/app/assets/javascripts/src/layout/container/Table.js +0 -412
- data/app/assets/javascripts/src/layout/container/VBox.js +0 -139
- data/app/assets/javascripts/src/layout/container/boxOverflow/Menu.js +0 -365
- data/app/assets/javascripts/src/layout/container/boxOverflow/None.js +0 -83
- data/app/assets/javascripts/src/layout/container/boxOverflow/Scroller.js +0 -475
- data/app/assets/javascripts/src/menu/CheckItem.js +0 -169
- data/app/assets/javascripts/src/menu/ColorPicker.js +0 -110
- data/app/assets/javascripts/src/menu/DatePicker.js +0 -100
- data/app/assets/javascripts/src/menu/Item.js +0 -553
- data/app/assets/javascripts/src/menu/KeyNav.js +0 -134
- data/app/assets/javascripts/src/menu/Manager.js +0 -219
- data/app/assets/javascripts/src/menu/Menu.js +0 -579
- data/app/assets/javascripts/src/menu/Separator.js +0 -126
- data/app/assets/javascripts/src/panel/AbstractPanel.js +0 -323
- data/app/assets/javascripts/src/panel/DD.js +0 -99
- data/app/assets/javascripts/src/panel/Header.js +0 -518
- data/app/assets/javascripts/src/panel/Panel.js +0 -2150
- data/app/assets/javascripts/src/panel/Proxy.js +0 -131
- data/app/assets/javascripts/src/panel/Table.js +0 -1018
- data/app/assets/javascripts/src/panel/Tool.js +0 -304
- data/app/assets/javascripts/src/picker/Color.js +0 -219
- data/app/assets/javascripts/src/picker/Date.js +0 -1140
- data/app/assets/javascripts/src/picker/Month.js +0 -490
- data/app/assets/javascripts/src/picker/Time.js +0 -165
- data/app/assets/javascripts/src/resizer/BorderSplitter.js +0 -22
- data/app/assets/javascripts/src/resizer/BorderSplitterTracker.js +0 -210
- data/app/assets/javascripts/src/resizer/Handle.js +0 -29
- data/app/assets/javascripts/src/resizer/ResizeTracker.js +0 -346
- data/app/assets/javascripts/src/resizer/Resizer.js +0 -477
- data/app/assets/javascripts/src/resizer/Splitter.js +0 -242
- data/app/assets/javascripts/src/resizer/SplitterTracker.js +0 -230
- data/app/assets/javascripts/src/selection/CellModel.js +0 -395
- data/app/assets/javascripts/src/selection/CheckboxModel.js +0 -234
- data/app/assets/javascripts/src/selection/DataViewModel.js +0 -160
- data/app/assets/javascripts/src/selection/Model.js +0 -646
- data/app/assets/javascripts/src/selection/RowModel.js +0 -499
- data/app/assets/javascripts/src/selection/TreeModel.js +0 -78
- data/app/assets/javascripts/src/slider/Multi.js +0 -835
- data/app/assets/javascripts/src/slider/Single.js +0 -56
- data/app/assets/javascripts/src/slider/Thumb.js +0 -259
- data/app/assets/javascripts/src/slider/Tip.js +0 -130
- data/app/assets/javascripts/src/state/CookieProvider.js +0 -120
- data/app/assets/javascripts/src/state/LocalStorageProvider.js +0 -72
- data/app/assets/javascripts/src/state/Manager.js +0 -70
- data/app/assets/javascripts/src/state/Provider.js +0 -182
- data/app/assets/javascripts/src/state/Stateful.js +0 -364
- data/app/assets/javascripts/src/tab/Bar.js +0 -258
- data/app/assets/javascripts/src/tab/Panel.js +0 -654
- data/app/assets/javascripts/src/tab/Tab.js +0 -358
- data/app/assets/javascripts/src/tail.js +0 -10
- data/app/assets/javascripts/src/tip/QuickTip.js +0 -335
- data/app/assets/javascripts/src/tip/QuickTipManager.js +0 -239
- data/app/assets/javascripts/src/tip/Tip.js +0 -160
- data/app/assets/javascripts/src/tip/ToolTip.js +0 -691
- data/app/assets/javascripts/src/toolbar/Fill.js +0 -28
- data/app/assets/javascripts/src/toolbar/Item.js +0 -16
- data/app/assets/javascripts/src/toolbar/Paging.js +0 -600
- data/app/assets/javascripts/src/toolbar/Separator.js +0 -23
- data/app/assets/javascripts/src/toolbar/Spacer.js +0 -33
- data/app/assets/javascripts/src/toolbar/TextItem.js +0 -57
- data/app/assets/javascripts/src/toolbar/Toolbar-legacy.js +0 -123
- data/app/assets/javascripts/src/toolbar/Toolbar.js +0 -447
- data/app/assets/javascripts/src/tree/Column.js +0 -90
- data/app/assets/javascripts/src/tree/Panel.js +0 -505
- data/app/assets/javascripts/src/tree/View.js +0 -658
- data/app/assets/javascripts/src/tree/ViewDragZone.js +0 -49
- data/app/assets/javascripts/src/tree/ViewDropZone.js +0 -287
- data/app/assets/javascripts/src/tree/plugin/TreeViewDragDrop.js +0 -244
- data/app/assets/javascripts/src/util/AbstractMixedCollection.js +0 -772
- data/app/assets/javascripts/src/util/Animate.js +0 -426
- data/app/assets/javascripts/src/util/Bindable.js +0 -102
- data/app/assets/javascripts/src/util/CSS.js +0 -185
- data/app/assets/javascripts/src/util/ClickRepeater.js +0 -238
- data/app/assets/javascripts/src/util/ComponentDragger.js +0 -126
- data/app/assets/javascripts/src/util/Cookies.js +0 -91
- data/app/assets/javascripts/src/util/ElementContainer.js +0 -293
- data/app/assets/javascripts/src/util/Filter.js +0 -159
- data/app/assets/javascripts/src/util/Floating.js +0 -321
- data/app/assets/javascripts/src/util/Grouper.js +0 -26
- data/app/assets/javascripts/src/util/HashMap.js +0 -356
- data/app/assets/javascripts/src/util/History.js +0 -285
- data/app/assets/javascripts/src/util/Inflector.js +0 -297
- data/app/assets/javascripts/src/util/KeyMap.js +0 -427
- data/app/assets/javascripts/src/util/KeyNav.js +0 -239
- data/app/assets/javascripts/src/util/LruCache.js +0 -257
- data/app/assets/javascripts/src/util/Memento.js +0 -131
- data/app/assets/javascripts/src/util/MixedCollection.js +0 -239
- data/app/assets/javascripts/src/util/Observable.js +0 -1003
- data/app/assets/javascripts/src/util/Offset.js +0 -60
- data/app/assets/javascripts/src/util/Point.js +0 -93
- data/app/assets/javascripts/src/util/ProtoElement.js +0 -205
- data/app/assets/javascripts/src/util/Queue.js +0 -76
- data/app/assets/javascripts/src/util/Region.js +0 -388
- data/app/assets/javascripts/src/util/Renderable.js +0 -1079
- data/app/assets/javascripts/src/util/Sortable.js +0 -248
- data/app/assets/javascripts/src/util/Sorter.js +0 -179
- data/app/assets/javascripts/src/util/TextMetrics.js +0 -148
- data/app/assets/javascripts/src/view/AbstractView.js +0 -1103
- data/app/assets/javascripts/src/view/BoundList.js +0 -207
- data/app/assets/javascripts/src/view/BoundListKeyNav.js +0 -92
- data/app/assets/javascripts/src/view/DragZone.js +0 -106
- data/app/assets/javascripts/src/view/DropZone.js +0 -240
- data/app/assets/javascripts/src/view/Table.js +0 -1229
- data/app/assets/javascripts/src/view/TableChunker.js +0 -139
- data/app/assets/javascripts/src/view/View.js +0 -636
- data/app/assets/javascripts/src/window/MessageBox.js +0 -880
- data/app/assets/javascripts/src/window/Window-legacy.js +0 -56
- data/app/assets/javascripts/src/window/Window.js +0 -793
@@ -1,1463 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @class Ext.Date
|
3
|
-
* A set of useful static methods to deal with date
|
4
|
-
* Note that if Ext.Date is required and loaded, it will copy all methods / properties to
|
5
|
-
* this object for convenience
|
6
|
-
*
|
7
|
-
* The date parsing and formatting syntax contains a subset of
|
8
|
-
* <a href="http://www.php.net/date">PHP's date() function</a>, and the formats that are
|
9
|
-
* supported will provide results equivalent to their PHP versions.
|
10
|
-
*
|
11
|
-
* The following is a list of all currently supported formats:
|
12
|
-
* <pre class="">
|
13
|
-
Format Description Example returned values
|
14
|
-
------ ----------------------------------------------------------------------- -----------------------
|
15
|
-
d Day of the month, 2 digits with leading zeros 01 to 31
|
16
|
-
D A short textual representation of the day of the week Mon to Sun
|
17
|
-
j Day of the month without leading zeros 1 to 31
|
18
|
-
l A full textual representation of the day of the week Sunday to Saturday
|
19
|
-
N ISO-8601 numeric representation of the day of the week 1 (for Monday) through 7 (for Sunday)
|
20
|
-
S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
|
21
|
-
w Numeric representation of the day of the week 0 (for Sunday) to 6 (for Saturday)
|
22
|
-
z The day of the year (starting from 0) 0 to 364 (365 in leap years)
|
23
|
-
W ISO-8601 week number of year, weeks starting on Monday 01 to 53
|
24
|
-
F A full textual representation of a month, such as January or March January to December
|
25
|
-
m Numeric representation of a month, with leading zeros 01 to 12
|
26
|
-
M A short textual representation of a month Jan to Dec
|
27
|
-
n Numeric representation of a month, without leading zeros 1 to 12
|
28
|
-
t Number of days in the given month 28 to 31
|
29
|
-
L Whether it's a leap year 1 if it is a leap year, 0 otherwise.
|
30
|
-
o ISO-8601 year number (identical to (Y), but if the ISO week number (W) Examples: 1998 or 2004
|
31
|
-
belongs to the previous or next year, that year is used instead)
|
32
|
-
Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003
|
33
|
-
y A two digit representation of a year Examples: 99 or 03
|
34
|
-
a Lowercase Ante meridiem and Post meridiem am or pm
|
35
|
-
A Uppercase Ante meridiem and Post meridiem AM or PM
|
36
|
-
g 12-hour format of an hour without leading zeros 1 to 12
|
37
|
-
G 24-hour format of an hour without leading zeros 0 to 23
|
38
|
-
h 12-hour format of an hour with leading zeros 01 to 12
|
39
|
-
H 24-hour format of an hour with leading zeros 00 to 23
|
40
|
-
i Minutes, with leading zeros 00 to 59
|
41
|
-
s Seconds, with leading zeros 00 to 59
|
42
|
-
u Decimal fraction of a second Examples:
|
43
|
-
(minimum 1 digit, arbitrary number of digits allowed) 001 (i.e. 0.001s) or
|
44
|
-
100 (i.e. 0.100s) or
|
45
|
-
999 (i.e. 0.999s) or
|
46
|
-
999876543210 (i.e. 0.999876543210s)
|
47
|
-
O Difference to Greenwich time (GMT) in hours and minutes Example: +1030
|
48
|
-
P Difference to Greenwich time (GMT) with colon between hours and minutes Example: -08:00
|
49
|
-
T Timezone abbreviation of the machine running the code Examples: EST, MDT, PDT ...
|
50
|
-
Z Timezone offset in seconds (negative if west of UTC, positive if east) -43200 to 50400
|
51
|
-
c ISO 8601 date
|
52
|
-
Notes: Examples:
|
53
|
-
1) If unspecified, the month / day defaults to the current month / day, 1991 or
|
54
|
-
the time defaults to midnight, while the timezone defaults to the 1992-10 or
|
55
|
-
browser's timezone. If a time is specified, it must include both hours 1993-09-20 or
|
56
|
-
and minutes. The "T" delimiter, seconds, milliseconds and timezone 1994-08-19T16:20+01:00 or
|
57
|
-
are optional. 1995-07-18T17:21:28-02:00 or
|
58
|
-
2) The decimal fraction of a second, if specified, must contain at 1996-06-17T18:22:29.98765+03:00 or
|
59
|
-
least 1 digit (there is no limit to the maximum number 1997-05-16T19:23:30,12345-0400 or
|
60
|
-
of digits allowed), and may be delimited by either a '.' or a ',' 1998-04-15T20:24:31.2468Z or
|
61
|
-
Refer to the examples on the right for the various levels of 1999-03-14T20:24:32Z or
|
62
|
-
date-time granularity which are supported, or see 2000-02-13T21:25:33
|
63
|
-
http://www.w3.org/TR/NOTE-datetime for more info. 2001-01-12 22:26:34
|
64
|
-
U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) 1193432466 or -2138434463
|
65
|
-
MS Microsoft AJAX serialized dates \/Date(1238606590509)\/ (i.e. UTC milliseconds since epoch) or
|
66
|
-
\/Date(1238606590509+0800)\/
|
67
|
-
</pre>
|
68
|
-
*
|
69
|
-
* Example usage (note that you must escape format specifiers with '\\' to render them as character literals):
|
70
|
-
* <pre><code>
|
71
|
-
// Sample date:
|
72
|
-
// 'Wed Jan 10 2007 15:05:01 GMT-0600 (Central Standard Time)'
|
73
|
-
|
74
|
-
var dt = new Date('1/10/2007 03:05:01 PM GMT-0600');
|
75
|
-
console.log(Ext.Date.format(dt, 'Y-m-d')); // 2007-01-10
|
76
|
-
console.log(Ext.Date.format(dt, 'F j, Y, g:i a')); // January 10, 2007, 3:05 pm
|
77
|
-
console.log(Ext.Date.format(dt, 'l, \\t\\he jS \\of F Y h:i:s A')); // Wednesday, the 10th of January 2007 03:05:01 PM
|
78
|
-
</code></pre>
|
79
|
-
*
|
80
|
-
* Here are some standard date/time patterns that you might find helpful. They
|
81
|
-
* are not part of the source of Ext.Date, but to use them you can simply copy this
|
82
|
-
* block of code into any script that is included after Ext.Date and they will also become
|
83
|
-
* globally available on the Date object. Feel free to add or remove patterns as needed in your code.
|
84
|
-
* <pre><code>
|
85
|
-
Ext.Date.patterns = {
|
86
|
-
ISO8601Long:"Y-m-d H:i:s",
|
87
|
-
ISO8601Short:"Y-m-d",
|
88
|
-
ShortDate: "n/j/Y",
|
89
|
-
LongDate: "l, F d, Y",
|
90
|
-
FullDateTime: "l, F d, Y g:i:s A",
|
91
|
-
MonthDay: "F d",
|
92
|
-
ShortTime: "g:i A",
|
93
|
-
LongTime: "g:i:s A",
|
94
|
-
SortableDateTime: "Y-m-d\\TH:i:s",
|
95
|
-
UniversalSortableDateTime: "Y-m-d H:i:sO",
|
96
|
-
YearMonth: "F, Y"
|
97
|
-
};
|
98
|
-
</code></pre>
|
99
|
-
*
|
100
|
-
* Example usage:
|
101
|
-
* <pre><code>
|
102
|
-
var dt = new Date();
|
103
|
-
console.log(Ext.Date.format(dt, Ext.Date.patterns.ShortDate));
|
104
|
-
</code></pre>
|
105
|
-
* <p>Developer-written, custom formats may be used by supplying both a formatting and a parsing function
|
106
|
-
* which perform to specialized requirements. The functions are stored in {@link #parseFunctions} and {@link #formatFunctions}.</p>
|
107
|
-
* @singleton
|
108
|
-
*/
|
109
|
-
|
110
|
-
/*
|
111
|
-
* Most of the date-formatting functions below are the excellent work of Baron Schwartz.
|
112
|
-
* (see http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/)
|
113
|
-
* They generate precompiled functions from format patterns instead of parsing and
|
114
|
-
* processing each pattern every time a date is formatted. These functions are available
|
115
|
-
* on every Date object.
|
116
|
-
*/
|
117
|
-
|
118
|
-
(function() {
|
119
|
-
|
120
|
-
// create private copy of Ext's Ext.util.Format.format() method
|
121
|
-
// - to remove unnecessary dependency
|
122
|
-
// - to resolve namespace conflict with MS-Ajax's implementation
|
123
|
-
function xf(format) {
|
124
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
125
|
-
return format.replace(/\{(\d+)\}/g, function(m, i) {
|
126
|
-
return args[i];
|
127
|
-
});
|
128
|
-
}
|
129
|
-
|
130
|
-
Ext.Date = {
|
131
|
-
/**
|
132
|
-
* Returns the current timestamp
|
133
|
-
* @return {Number} The current timestamp
|
134
|
-
* @method
|
135
|
-
*/
|
136
|
-
now: Date.now || function() {
|
137
|
-
return +new Date();
|
138
|
-
},
|
139
|
-
|
140
|
-
/**
|
141
|
-
* @private
|
142
|
-
* Private for now
|
143
|
-
*/
|
144
|
-
toString: function(date) {
|
145
|
-
var pad = Ext.String.leftPad;
|
146
|
-
|
147
|
-
return date.getFullYear() + "-"
|
148
|
-
+ pad(date.getMonth() + 1, 2, '0') + "-"
|
149
|
-
+ pad(date.getDate(), 2, '0') + "T"
|
150
|
-
+ pad(date.getHours(), 2, '0') + ":"
|
151
|
-
+ pad(date.getMinutes(), 2, '0') + ":"
|
152
|
-
+ pad(date.getSeconds(), 2, '0');
|
153
|
-
},
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Returns the number of milliseconds between two dates
|
157
|
-
* @param {Date} dateA The first date
|
158
|
-
* @param {Date} dateB (optional) The second date, defaults to now
|
159
|
-
* @return {Number} The difference in milliseconds
|
160
|
-
*/
|
161
|
-
getElapsed: function(dateA, dateB) {
|
162
|
-
return Math.abs(dateA - (dateB || new Date()));
|
163
|
-
},
|
164
|
-
|
165
|
-
/**
|
166
|
-
* Global flag which determines if strict date parsing should be used.
|
167
|
-
* Strict date parsing will not roll-over invalid dates, which is the
|
168
|
-
* default behaviour of javascript Date objects.
|
169
|
-
* (see {@link #parse} for more information)
|
170
|
-
* Defaults to <tt>false</tt>.
|
171
|
-
* @type Boolean
|
172
|
-
*/
|
173
|
-
useStrict: false,
|
174
|
-
|
175
|
-
// private
|
176
|
-
formatCodeToRegex: function(character, currentGroup) {
|
177
|
-
// Note: currentGroup - position in regex result array (see notes for Ext.Date.parseCodes below)
|
178
|
-
var p = utilDate.parseCodes[character];
|
179
|
-
|
180
|
-
if (p) {
|
181
|
-
p = typeof p == 'function'? p() : p;
|
182
|
-
utilDate.parseCodes[character] = p; // reassign function result to prevent repeated execution
|
183
|
-
}
|
184
|
-
|
185
|
-
return p ? Ext.applyIf({
|
186
|
-
c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
|
187
|
-
}, p) : {
|
188
|
-
g: 0,
|
189
|
-
c: null,
|
190
|
-
s: Ext.String.escapeRegex(character) // treat unrecognised characters as literals
|
191
|
-
};
|
192
|
-
},
|
193
|
-
|
194
|
-
/**
|
195
|
-
* <p>An object hash in which each property is a date parsing function. The property name is the
|
196
|
-
* format string which that function parses.</p>
|
197
|
-
* <p>This object is automatically populated with date parsing functions as
|
198
|
-
* date formats are requested for Ext standard formatting strings.</p>
|
199
|
-
* <p>Custom parsing functions may be inserted into this object, keyed by a name which from then on
|
200
|
-
* may be used as a format string to {@link #parse}.<p>
|
201
|
-
* <p>Example:</p><pre><code>
|
202
|
-
Ext.Date.parseFunctions['x-date-format'] = myDateParser;
|
203
|
-
</code></pre>
|
204
|
-
* <p>A parsing function should return a Date object, and is passed the following parameters:<div class="mdetail-params"><ul>
|
205
|
-
* <li><code>date</code> : String<div class="sub-desc">The date string to parse.</div></li>
|
206
|
-
* <li><code>strict</code> : Boolean<div class="sub-desc">True to validate date strings while parsing
|
207
|
-
* (i.e. prevent javascript Date "rollover") (The default must be false).
|
208
|
-
* Invalid date strings should return null when parsed.</div></li>
|
209
|
-
* </ul></div></p>
|
210
|
-
* <p>To enable Dates to also be <i>formatted</i> according to that format, a corresponding
|
211
|
-
* formatting function must be placed into the {@link #formatFunctions} property.
|
212
|
-
* @property parseFunctions
|
213
|
-
* @type Object
|
214
|
-
*/
|
215
|
-
parseFunctions: {
|
216
|
-
"MS": function(input, strict) {
|
217
|
-
// note: the timezone offset is ignored since the MS Ajax server sends
|
218
|
-
// a UTC milliseconds-since-Unix-epoch value (negative values are allowed)
|
219
|
-
var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/'),
|
220
|
-
r = (input || '').match(re);
|
221
|
-
return r? new Date(((r[1] || '') + r[2]) * 1) : null;
|
222
|
-
}
|
223
|
-
},
|
224
|
-
parseRegexes: [],
|
225
|
-
|
226
|
-
/**
|
227
|
-
* <p>An object hash in which each property is a date formatting function. The property name is the
|
228
|
-
* format string which corresponds to the produced formatted date string.</p>
|
229
|
-
* <p>This object is automatically populated with date formatting functions as
|
230
|
-
* date formats are requested for Ext standard formatting strings.</p>
|
231
|
-
* <p>Custom formatting functions may be inserted into this object, keyed by a name which from then on
|
232
|
-
* may be used as a format string to {@link #format}. Example:</p><pre><code>
|
233
|
-
Ext.Date.formatFunctions['x-date-format'] = myDateFormatter;
|
234
|
-
</code></pre>
|
235
|
-
* <p>A formatting function should return a string representation of the passed Date object, and is passed the following parameters:<div class="mdetail-params"><ul>
|
236
|
-
* <li><code>date</code> : Date<div class="sub-desc">The Date to format.</div></li>
|
237
|
-
* </ul></div></p>
|
238
|
-
* <p>To enable date strings to also be <i>parsed</i> according to that format, a corresponding
|
239
|
-
* parsing function must be placed into the {@link #parseFunctions} property.
|
240
|
-
* @property formatFunctions
|
241
|
-
* @type Object
|
242
|
-
*/
|
243
|
-
formatFunctions: {
|
244
|
-
"MS": function() {
|
245
|
-
// UTC milliseconds since Unix epoch (MS-AJAX serialized date format (MRSF))
|
246
|
-
return '\\/Date(' + this.getTime() + ')\\/';
|
247
|
-
}
|
248
|
-
},
|
249
|
-
|
250
|
-
y2kYear : 50,
|
251
|
-
|
252
|
-
/**
|
253
|
-
* Date interval constant
|
254
|
-
* @type String
|
255
|
-
*/
|
256
|
-
MILLI : "ms",
|
257
|
-
|
258
|
-
/**
|
259
|
-
* Date interval constant
|
260
|
-
* @type String
|
261
|
-
*/
|
262
|
-
SECOND : "s",
|
263
|
-
|
264
|
-
/**
|
265
|
-
* Date interval constant
|
266
|
-
* @type String
|
267
|
-
*/
|
268
|
-
MINUTE : "mi",
|
269
|
-
|
270
|
-
/** Date interval constant
|
271
|
-
* @type String
|
272
|
-
*/
|
273
|
-
HOUR : "h",
|
274
|
-
|
275
|
-
/**
|
276
|
-
* Date interval constant
|
277
|
-
* @type String
|
278
|
-
*/
|
279
|
-
DAY : "d",
|
280
|
-
|
281
|
-
/**
|
282
|
-
* Date interval constant
|
283
|
-
* @type String
|
284
|
-
*/
|
285
|
-
MONTH : "mo",
|
286
|
-
|
287
|
-
/**
|
288
|
-
* Date interval constant
|
289
|
-
* @type String
|
290
|
-
*/
|
291
|
-
YEAR : "y",
|
292
|
-
|
293
|
-
/**
|
294
|
-
* <p>An object hash containing default date values used during date parsing.</p>
|
295
|
-
* <p>The following properties are available:<div class="mdetail-params"><ul>
|
296
|
-
* <li><code>y</code> : Number<div class="sub-desc">The default year value. (defaults to undefined)</div></li>
|
297
|
-
* <li><code>m</code> : Number<div class="sub-desc">The default 1-based month value. (defaults to undefined)</div></li>
|
298
|
-
* <li><code>d</code> : Number<div class="sub-desc">The default day value. (defaults to undefined)</div></li>
|
299
|
-
* <li><code>h</code> : Number<div class="sub-desc">The default hour value. (defaults to undefined)</div></li>
|
300
|
-
* <li><code>i</code> : Number<div class="sub-desc">The default minute value. (defaults to undefined)</div></li>
|
301
|
-
* <li><code>s</code> : Number<div class="sub-desc">The default second value. (defaults to undefined)</div></li>
|
302
|
-
* <li><code>ms</code> : Number<div class="sub-desc">The default millisecond value. (defaults to undefined)</div></li>
|
303
|
-
* </ul></div></p>
|
304
|
-
* <p>Override these properties to customize the default date values used by the {@link #parse} method.</p>
|
305
|
-
* <p><b>Note: In countries which experience Daylight Saving Time (i.e. DST), the <tt>h</tt>, <tt>i</tt>, <tt>s</tt>
|
306
|
-
* and <tt>ms</tt> properties may coincide with the exact time in which DST takes effect.
|
307
|
-
* It is the responsiblity of the developer to account for this.</b></p>
|
308
|
-
* Example Usage:
|
309
|
-
* <pre><code>
|
310
|
-
// set default day value to the first day of the month
|
311
|
-
Ext.Date.defaults.d = 1;
|
312
|
-
|
313
|
-
// parse a February date string containing only year and month values.
|
314
|
-
// setting the default day value to 1 prevents weird date rollover issues
|
315
|
-
// when attempting to parse the following date string on, for example, March 31st 2009.
|
316
|
-
Ext.Date.parse('2009-02', 'Y-m'); // returns a Date object representing February 1st 2009
|
317
|
-
</code></pre>
|
318
|
-
* @property defaults
|
319
|
-
* @type Object
|
320
|
-
*/
|
321
|
-
defaults: {},
|
322
|
-
|
323
|
-
//<locale type="array">
|
324
|
-
/**
|
325
|
-
* @property {String[]} dayNames
|
326
|
-
* An array of textual day names.
|
327
|
-
* Override these values for international dates.
|
328
|
-
* Example:
|
329
|
-
* <pre><code>
|
330
|
-
Ext.Date.dayNames = [
|
331
|
-
'SundayInYourLang',
|
332
|
-
'MondayInYourLang',
|
333
|
-
...
|
334
|
-
];
|
335
|
-
</code></pre>
|
336
|
-
*/
|
337
|
-
dayNames : [
|
338
|
-
"Sunday",
|
339
|
-
"Monday",
|
340
|
-
"Tuesday",
|
341
|
-
"Wednesday",
|
342
|
-
"Thursday",
|
343
|
-
"Friday",
|
344
|
-
"Saturday"
|
345
|
-
],
|
346
|
-
//</locale>
|
347
|
-
|
348
|
-
//<locale type="array">
|
349
|
-
/**
|
350
|
-
* @property {String[]} monthNames
|
351
|
-
* An array of textual month names.
|
352
|
-
* Override these values for international dates.
|
353
|
-
* Example:
|
354
|
-
* <pre><code>
|
355
|
-
Ext.Date.monthNames = [
|
356
|
-
'JanInYourLang',
|
357
|
-
'FebInYourLang',
|
358
|
-
...
|
359
|
-
];
|
360
|
-
</code></pre>
|
361
|
-
*/
|
362
|
-
monthNames : [
|
363
|
-
"January",
|
364
|
-
"February",
|
365
|
-
"March",
|
366
|
-
"April",
|
367
|
-
"May",
|
368
|
-
"June",
|
369
|
-
"July",
|
370
|
-
"August",
|
371
|
-
"September",
|
372
|
-
"October",
|
373
|
-
"November",
|
374
|
-
"December"
|
375
|
-
],
|
376
|
-
//</locale>
|
377
|
-
|
378
|
-
//<locale type="object">
|
379
|
-
/**
|
380
|
-
* @property {Object} monthNumbers
|
381
|
-
* An object hash of zero-based javascript month numbers (with short month names as keys. note: keys are case-sensitive).
|
382
|
-
* Override these values for international dates.
|
383
|
-
* Example:
|
384
|
-
* <pre><code>
|
385
|
-
Ext.Date.monthNumbers = {
|
386
|
-
'LongJanNameInYourLang': 0,
|
387
|
-
'ShortJanNameInYourLang':0,
|
388
|
-
'LongFebNameInYourLang':1,
|
389
|
-
'ShortFebNameInYourLang':1,
|
390
|
-
...
|
391
|
-
};
|
392
|
-
</code></pre>
|
393
|
-
*/
|
394
|
-
monthNumbers : {
|
395
|
-
January: 0,
|
396
|
-
Jan: 0,
|
397
|
-
February: 1,
|
398
|
-
Feb: 1,
|
399
|
-
March: 2,
|
400
|
-
Mar: 2,
|
401
|
-
April: 3,
|
402
|
-
Apr: 3,
|
403
|
-
May: 4,
|
404
|
-
June: 5,
|
405
|
-
Jun: 5,
|
406
|
-
July: 6,
|
407
|
-
Jul: 6,
|
408
|
-
August: 7,
|
409
|
-
Aug: 7,
|
410
|
-
September: 8,
|
411
|
-
Sep: 8,
|
412
|
-
October: 9,
|
413
|
-
Oct: 9,
|
414
|
-
November: 10,
|
415
|
-
Nov: 10,
|
416
|
-
December: 11,
|
417
|
-
Dec: 11
|
418
|
-
},
|
419
|
-
//</locale>
|
420
|
-
|
421
|
-
//<locale>
|
422
|
-
/**
|
423
|
-
* @property {String} defaultFormat
|
424
|
-
* <p>The date format string that the {@link Ext.util.Format#dateRenderer}
|
425
|
-
* and {@link Ext.util.Format#date} functions use. See {@link Ext.Date} for details.</p>
|
426
|
-
* <p>This may be overridden in a locale file.</p>
|
427
|
-
*/
|
428
|
-
defaultFormat : "m/d/Y",
|
429
|
-
//</locale>
|
430
|
-
//<locale type="function">
|
431
|
-
/**
|
432
|
-
* Get the short month name for the given month number.
|
433
|
-
* Override this function for international dates.
|
434
|
-
* @param {Number} month A zero-based javascript month number.
|
435
|
-
* @return {String} The short month name.
|
436
|
-
*/
|
437
|
-
getShortMonthName : function(month) {
|
438
|
-
return Ext.Date.monthNames[month].substring(0, 3);
|
439
|
-
},
|
440
|
-
//</locale>
|
441
|
-
|
442
|
-
//<locale type="function">
|
443
|
-
/**
|
444
|
-
* Get the short day name for the given day number.
|
445
|
-
* Override this function for international dates.
|
446
|
-
* @param {Number} day A zero-based javascript day number.
|
447
|
-
* @return {String} The short day name.
|
448
|
-
*/
|
449
|
-
getShortDayName : function(day) {
|
450
|
-
return Ext.Date.dayNames[day].substring(0, 3);
|
451
|
-
},
|
452
|
-
//</locale>
|
453
|
-
|
454
|
-
//<locale type="function">
|
455
|
-
/**
|
456
|
-
* Get the zero-based javascript month number for the given short/full month name.
|
457
|
-
* Override this function for international dates.
|
458
|
-
* @param {String} name The short/full month name.
|
459
|
-
* @return {Number} The zero-based javascript month number.
|
460
|
-
*/
|
461
|
-
getMonthNumber : function(name) {
|
462
|
-
// handle camel casing for english month names (since the keys for the Ext.Date.monthNumbers hash are case sensitive)
|
463
|
-
return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
|
464
|
-
},
|
465
|
-
//</locale>
|
466
|
-
|
467
|
-
/**
|
468
|
-
* Checks if the specified format contains hour information
|
469
|
-
* @param {String} format The format to check
|
470
|
-
* @return {Boolean} True if the format contains hour information
|
471
|
-
* @method
|
472
|
-
*/
|
473
|
-
formatContainsHourInfo : (function(){
|
474
|
-
var stripEscapeRe = /(\\.)/g,
|
475
|
-
hourInfoRe = /([gGhHisucUOPZ]|MS)/;
|
476
|
-
return function(format){
|
477
|
-
return hourInfoRe.test(format.replace(stripEscapeRe, ''));
|
478
|
-
};
|
479
|
-
}()),
|
480
|
-
|
481
|
-
/**
|
482
|
-
* Checks if the specified format contains information about
|
483
|
-
* anything other than the time.
|
484
|
-
* @param {String} format The format to check
|
485
|
-
* @return {Boolean} True if the format contains information about
|
486
|
-
* date/day information.
|
487
|
-
* @method
|
488
|
-
*/
|
489
|
-
formatContainsDateInfo : (function(){
|
490
|
-
var stripEscapeRe = /(\\.)/g,
|
491
|
-
dateInfoRe = /([djzmnYycU]|MS)/;
|
492
|
-
|
493
|
-
return function(format){
|
494
|
-
return dateInfoRe.test(format.replace(stripEscapeRe, ''));
|
495
|
-
};
|
496
|
-
}()),
|
497
|
-
|
498
|
-
/**
|
499
|
-
* Removes all escaping for a date format string. In date formats,
|
500
|
-
* using a '\' can be used to escape special characters.
|
501
|
-
* @param {String} format The format to unescape
|
502
|
-
* @return {String} The unescaped format
|
503
|
-
* @method
|
504
|
-
*/
|
505
|
-
unescapeFormat: (function() {
|
506
|
-
var slashRe = /\\/gi;
|
507
|
-
return function(format) {
|
508
|
-
// Escape the format, since \ can be used to escape special
|
509
|
-
// characters in a date format. For example, in a spanish
|
510
|
-
// locale the format may be: 'd \\de F \\de Y'
|
511
|
-
return format.replace(slashRe, '');
|
512
|
-
}
|
513
|
-
}()),
|
514
|
-
|
515
|
-
/**
|
516
|
-
* The base format-code to formatting-function hashmap used by the {@link #format} method.
|
517
|
-
* Formatting functions are strings (or functions which return strings) which
|
518
|
-
* will return the appropriate value when evaluated in the context of the Date object
|
519
|
-
* from which the {@link #format} method is called.
|
520
|
-
* Add to / override these mappings for custom date formatting.
|
521
|
-
* Note: Ext.Date.format() treats characters as literals if an appropriate mapping cannot be found.
|
522
|
-
* Example:
|
523
|
-
* <pre><code>
|
524
|
-
Ext.Date.formatCodes.x = "Ext.util.Format.leftPad(this.getDate(), 2, '0')";
|
525
|
-
console.log(Ext.Date.format(new Date(), 'X'); // returns the current day of the month
|
526
|
-
</code></pre>
|
527
|
-
* @type Object
|
528
|
-
*/
|
529
|
-
formatCodes : {
|
530
|
-
d: "Ext.String.leftPad(this.getDate(), 2, '0')",
|
531
|
-
D: "Ext.Date.getShortDayName(this.getDay())", // get localised short day name
|
532
|
-
j: "this.getDate()",
|
533
|
-
l: "Ext.Date.dayNames[this.getDay()]",
|
534
|
-
N: "(this.getDay() ? this.getDay() : 7)",
|
535
|
-
S: "Ext.Date.getSuffix(this)",
|
536
|
-
w: "this.getDay()",
|
537
|
-
z: "Ext.Date.getDayOfYear(this)",
|
538
|
-
W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')",
|
539
|
-
F: "Ext.Date.monthNames[this.getMonth()]",
|
540
|
-
m: "Ext.String.leftPad(this.getMonth() + 1, 2, '0')",
|
541
|
-
M: "Ext.Date.getShortMonthName(this.getMonth())", // get localised short month name
|
542
|
-
n: "(this.getMonth() + 1)",
|
543
|
-
t: "Ext.Date.getDaysInMonth(this)",
|
544
|
-
L: "(Ext.Date.isLeapYear(this) ? 1 : 0)",
|
545
|
-
o: "(this.getFullYear() + (Ext.Date.getWeekOfYear(this) == 1 && this.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(this) >= 52 && this.getMonth() < 11 ? -1 : 0)))",
|
546
|
-
Y: "Ext.String.leftPad(this.getFullYear(), 4, '0')",
|
547
|
-
y: "('' + this.getFullYear()).substring(2, 4)",
|
548
|
-
a: "(this.getHours() < 12 ? 'am' : 'pm')",
|
549
|
-
A: "(this.getHours() < 12 ? 'AM' : 'PM')",
|
550
|
-
g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
|
551
|
-
G: "this.getHours()",
|
552
|
-
h: "Ext.String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
|
553
|
-
H: "Ext.String.leftPad(this.getHours(), 2, '0')",
|
554
|
-
i: "Ext.String.leftPad(this.getMinutes(), 2, '0')",
|
555
|
-
s: "Ext.String.leftPad(this.getSeconds(), 2, '0')",
|
556
|
-
u: "Ext.String.leftPad(this.getMilliseconds(), 3, '0')",
|
557
|
-
O: "Ext.Date.getGMTOffset(this)",
|
558
|
-
P: "Ext.Date.getGMTOffset(this, true)",
|
559
|
-
T: "Ext.Date.getTimezone(this)",
|
560
|
-
Z: "(this.getTimezoneOffset() * -60)",
|
561
|
-
|
562
|
-
c: function() { // ISO-8601 -- GMT format
|
563
|
-
var c, code, i, l, e;
|
564
|
-
for (c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
|
565
|
-
e = c.charAt(i);
|
566
|
-
code.push(e == "T" ? "'T'" : utilDate.getFormatCode(e)); // treat T as a character literal
|
567
|
-
}
|
568
|
-
return code.join(" + ");
|
569
|
-
},
|
570
|
-
/*
|
571
|
-
c: function() { // ISO-8601 -- UTC format
|
572
|
-
return [
|
573
|
-
"this.getUTCFullYear()", "'-'",
|
574
|
-
"Ext.util.Format.leftPad(this.getUTCMonth() + 1, 2, '0')", "'-'",
|
575
|
-
"Ext.util.Format.leftPad(this.getUTCDate(), 2, '0')",
|
576
|
-
"'T'",
|
577
|
-
"Ext.util.Format.leftPad(this.getUTCHours(), 2, '0')", "':'",
|
578
|
-
"Ext.util.Format.leftPad(this.getUTCMinutes(), 2, '0')", "':'",
|
579
|
-
"Ext.util.Format.leftPad(this.getUTCSeconds(), 2, '0')",
|
580
|
-
"'Z'"
|
581
|
-
].join(" + ");
|
582
|
-
},
|
583
|
-
*/
|
584
|
-
|
585
|
-
U: "Math.round(this.getTime() / 1000)"
|
586
|
-
},
|
587
|
-
|
588
|
-
/**
|
589
|
-
* Checks if the passed Date parameters will cause a javascript Date "rollover".
|
590
|
-
* @param {Number} year 4-digit year
|
591
|
-
* @param {Number} month 1-based month-of-year
|
592
|
-
* @param {Number} day Day of month
|
593
|
-
* @param {Number} hour (optional) Hour
|
594
|
-
* @param {Number} minute (optional) Minute
|
595
|
-
* @param {Number} second (optional) Second
|
596
|
-
* @param {Number} millisecond (optional) Millisecond
|
597
|
-
* @return {Boolean} true if the passed parameters do not cause a Date "rollover", false otherwise.
|
598
|
-
*/
|
599
|
-
isValid : function(y, m, d, h, i, s, ms) {
|
600
|
-
// setup defaults
|
601
|
-
h = h || 0;
|
602
|
-
i = i || 0;
|
603
|
-
s = s || 0;
|
604
|
-
ms = ms || 0;
|
605
|
-
|
606
|
-
// Special handling for year < 100
|
607
|
-
var dt = utilDate.add(new Date(y < 100 ? 100 : y, m - 1, d, h, i, s, ms), utilDate.YEAR, y < 100 ? y - 100 : 0);
|
608
|
-
|
609
|
-
return y == dt.getFullYear() &&
|
610
|
-
m == dt.getMonth() + 1 &&
|
611
|
-
d == dt.getDate() &&
|
612
|
-
h == dt.getHours() &&
|
613
|
-
i == dt.getMinutes() &&
|
614
|
-
s == dt.getSeconds() &&
|
615
|
-
ms == dt.getMilliseconds();
|
616
|
-
},
|
617
|
-
|
618
|
-
/**
|
619
|
-
* Parses the passed string using the specified date format.
|
620
|
-
* Note that this function expects normal calendar dates, meaning that months are 1-based (i.e. 1 = January).
|
621
|
-
* The {@link #defaults} hash will be used for any date value (i.e. year, month, day, hour, minute, second or millisecond)
|
622
|
-
* which cannot be found in the passed string. If a corresponding default date value has not been specified in the {@link #defaults} hash,
|
623
|
-
* the current date's year, month, day or DST-adjusted zero-hour time value will be used instead.
|
624
|
-
* Keep in mind that the input date string must precisely match the specified format string
|
625
|
-
* in order for the parse operation to be successful (failed parse operations return a null value).
|
626
|
-
* <p>Example:</p><pre><code>
|
627
|
-
//dt = Fri May 25 2007 (current date)
|
628
|
-
var dt = new Date();
|
629
|
-
|
630
|
-
//dt = Thu May 25 2006 (today's month/day in 2006)
|
631
|
-
dt = Ext.Date.parse("2006", "Y");
|
632
|
-
|
633
|
-
//dt = Sun Jan 15 2006 (all date parts specified)
|
634
|
-
dt = Ext.Date.parse("2006-01-15", "Y-m-d");
|
635
|
-
|
636
|
-
//dt = Sun Jan 15 2006 15:20:01
|
637
|
-
dt = Ext.Date.parse("2006-01-15 3:20:01 PM", "Y-m-d g:i:s A");
|
638
|
-
|
639
|
-
// attempt to parse Sun Feb 29 2006 03:20:01 in strict mode
|
640
|
-
dt = Ext.Date.parse("2006-02-29 03:20:01", "Y-m-d H:i:s", true); // returns null
|
641
|
-
</code></pre>
|
642
|
-
* @param {String} input The raw date string.
|
643
|
-
* @param {String} format The expected date string format.
|
644
|
-
* @param {Boolean} strict (optional) True to validate date strings while parsing (i.e. prevents javascript Date "rollover")
|
645
|
-
(defaults to false). Invalid date strings will return null when parsed.
|
646
|
-
* @return {Date} The parsed Date.
|
647
|
-
*/
|
648
|
-
parse : function(input, format, strict) {
|
649
|
-
var p = utilDate.parseFunctions;
|
650
|
-
if (p[format] == null) {
|
651
|
-
utilDate.createParser(format);
|
652
|
-
}
|
653
|
-
return p[format](input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
|
654
|
-
},
|
655
|
-
|
656
|
-
// Backwards compat
|
657
|
-
parseDate: function(input, format, strict){
|
658
|
-
return utilDate.parse(input, format, strict);
|
659
|
-
},
|
660
|
-
|
661
|
-
|
662
|
-
// private
|
663
|
-
getFormatCode : function(character) {
|
664
|
-
var f = utilDate.formatCodes[character];
|
665
|
-
|
666
|
-
if (f) {
|
667
|
-
f = typeof f == 'function'? f() : f;
|
668
|
-
utilDate.formatCodes[character] = f; // reassign function result to prevent repeated execution
|
669
|
-
}
|
670
|
-
|
671
|
-
// note: unknown characters are treated as literals
|
672
|
-
return f || ("'" + Ext.String.escape(character) + "'");
|
673
|
-
},
|
674
|
-
|
675
|
-
// private
|
676
|
-
createFormat : function(format) {
|
677
|
-
var code = [],
|
678
|
-
special = false,
|
679
|
-
ch = '',
|
680
|
-
i;
|
681
|
-
|
682
|
-
for (i = 0; i < format.length; ++i) {
|
683
|
-
ch = format.charAt(i);
|
684
|
-
if (!special && ch == "\\") {
|
685
|
-
special = true;
|
686
|
-
} else if (special) {
|
687
|
-
special = false;
|
688
|
-
code.push("'" + Ext.String.escape(ch) + "'");
|
689
|
-
} else {
|
690
|
-
code.push(utilDate.getFormatCode(ch));
|
691
|
-
}
|
692
|
-
}
|
693
|
-
utilDate.formatFunctions[format] = Ext.functionFactory("return " + code.join('+'));
|
694
|
-
},
|
695
|
-
|
696
|
-
// private
|
697
|
-
createParser : (function() {
|
698
|
-
var code = [
|
699
|
-
"var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
|
700
|
-
"def = Ext.Date.defaults,",
|
701
|
-
"results = String(input).match(Ext.Date.parseRegexes[{0}]);", // either null, or an array of matched strings
|
702
|
-
|
703
|
-
"if(results){",
|
704
|
-
"{1}",
|
705
|
-
|
706
|
-
"if(u != null){", // i.e. unix time is defined
|
707
|
-
"v = new Date(u * 1000);", // give top priority to UNIX time
|
708
|
-
"}else{",
|
709
|
-
// create Date object representing midnight of the current day;
|
710
|
-
// this will provide us with our date defaults
|
711
|
-
// (note: clearTime() handles Daylight Saving Time automatically)
|
712
|
-
"dt = Ext.Date.clearTime(new Date);",
|
713
|
-
|
714
|
-
// date calculations (note: these calculations create a dependency on Ext.Number.from())
|
715
|
-
"y = Ext.Number.from(y, Ext.Number.from(def.y, dt.getFullYear()));",
|
716
|
-
"m = Ext.Number.from(m, Ext.Number.from(def.m - 1, dt.getMonth()));",
|
717
|
-
"d = Ext.Number.from(d, Ext.Number.from(def.d, dt.getDate()));",
|
718
|
-
|
719
|
-
// time calculations (note: these calculations create a dependency on Ext.Number.from())
|
720
|
-
"h = Ext.Number.from(h, Ext.Number.from(def.h, dt.getHours()));",
|
721
|
-
"i = Ext.Number.from(i, Ext.Number.from(def.i, dt.getMinutes()));",
|
722
|
-
"s = Ext.Number.from(s, Ext.Number.from(def.s, dt.getSeconds()));",
|
723
|
-
"ms = Ext.Number.from(ms, Ext.Number.from(def.ms, dt.getMilliseconds()));",
|
724
|
-
|
725
|
-
"if(z >= 0 && y >= 0){",
|
726
|
-
// both the year and zero-based day of year are defined and >= 0.
|
727
|
-
// these 2 values alone provide sufficient info to create a full date object
|
728
|
-
|
729
|
-
// create Date object representing January 1st for the given year
|
730
|
-
// handle years < 100 appropriately
|
731
|
-
"v = Ext.Date.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
|
732
|
-
|
733
|
-
// then add day of year, checking for Date "rollover" if necessary
|
734
|
-
"v = !strict? v : (strict === true && (z <= 364 || (Ext.Date.isLeapYear(v) && z <= 365))? Ext.Date.add(v, Ext.Date.DAY, z) : null);",
|
735
|
-
"}else if(strict === true && !Ext.Date.isValid(y, m + 1, d, h, i, s, ms)){", // check for Date "rollover"
|
736
|
-
"v = null;", // invalid date, so return null
|
737
|
-
"}else{",
|
738
|
-
// plain old Date object
|
739
|
-
// handle years < 100 properly
|
740
|
-
"v = Ext.Date.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
|
741
|
-
"}",
|
742
|
-
"}",
|
743
|
-
"}",
|
744
|
-
|
745
|
-
"if(v){",
|
746
|
-
// favour UTC offset over GMT offset
|
747
|
-
"if(zz != null){",
|
748
|
-
// reset to UTC, then add offset
|
749
|
-
"v = Ext.Date.add(v, Ext.Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
|
750
|
-
"}else if(o){",
|
751
|
-
// reset to GMT, then add offset
|
752
|
-
"v = Ext.Date.add(v, Ext.Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
|
753
|
-
"}",
|
754
|
-
"}",
|
755
|
-
|
756
|
-
"return v;"
|
757
|
-
].join('\n');
|
758
|
-
|
759
|
-
return function(format) {
|
760
|
-
var regexNum = utilDate.parseRegexes.length,
|
761
|
-
currentGroup = 1,
|
762
|
-
calc = [],
|
763
|
-
regex = [],
|
764
|
-
special = false,
|
765
|
-
ch = "",
|
766
|
-
i = 0,
|
767
|
-
len = format.length,
|
768
|
-
atEnd = [],
|
769
|
-
obj;
|
770
|
-
|
771
|
-
for (; i < len; ++i) {
|
772
|
-
ch = format.charAt(i);
|
773
|
-
if (!special && ch == "\\") {
|
774
|
-
special = true;
|
775
|
-
} else if (special) {
|
776
|
-
special = false;
|
777
|
-
regex.push(Ext.String.escape(ch));
|
778
|
-
} else {
|
779
|
-
obj = utilDate.formatCodeToRegex(ch, currentGroup);
|
780
|
-
currentGroup += obj.g;
|
781
|
-
regex.push(obj.s);
|
782
|
-
if (obj.g && obj.c) {
|
783
|
-
if (obj.calcAtEnd) {
|
784
|
-
atEnd.push(obj.c);
|
785
|
-
} else {
|
786
|
-
calc.push(obj.c);
|
787
|
-
}
|
788
|
-
}
|
789
|
-
}
|
790
|
-
}
|
791
|
-
|
792
|
-
calc = calc.concat(atEnd);
|
793
|
-
|
794
|
-
utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
|
795
|
-
utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
|
796
|
-
};
|
797
|
-
}()),
|
798
|
-
|
799
|
-
// private
|
800
|
-
parseCodes : {
|
801
|
-
/*
|
802
|
-
* Notes:
|
803
|
-
* g = {Number} calculation group (0 or 1. only group 1 contributes to date calculations.)
|
804
|
-
* c = {String} calculation method (required for group 1. null for group 0. {0} = currentGroup - position in regex result array)
|
805
|
-
* s = {String} regex pattern. all matches are stored in results[], and are accessible by the calculation mapped to 'c'
|
806
|
-
*/
|
807
|
-
d: {
|
808
|
-
g:1,
|
809
|
-
c:"d = parseInt(results[{0}], 10);\n",
|
810
|
-
s:"(3[0-1]|[1-2][0-9]|0[1-9])" // day of month with leading zeroes (01 - 31)
|
811
|
-
},
|
812
|
-
j: {
|
813
|
-
g:1,
|
814
|
-
c:"d = parseInt(results[{0}], 10);\n",
|
815
|
-
s:"(3[0-1]|[1-2][0-9]|[1-9])" // day of month without leading zeroes (1 - 31)
|
816
|
-
},
|
817
|
-
D: function() {
|
818
|
-
for (var a = [], i = 0; i < 7; a.push(utilDate.getShortDayName(i)), ++i); // get localised short day names
|
819
|
-
return {
|
820
|
-
g:0,
|
821
|
-
c:null,
|
822
|
-
s:"(?:" + a.join("|") +")"
|
823
|
-
};
|
824
|
-
},
|
825
|
-
l: function() {
|
826
|
-
return {
|
827
|
-
g:0,
|
828
|
-
c:null,
|
829
|
-
s:"(?:" + utilDate.dayNames.join("|") + ")"
|
830
|
-
};
|
831
|
-
},
|
832
|
-
N: {
|
833
|
-
g:0,
|
834
|
-
c:null,
|
835
|
-
s:"[1-7]" // ISO-8601 day number (1 (monday) - 7 (sunday))
|
836
|
-
},
|
837
|
-
//<locale type="object" property="parseCodes">
|
838
|
-
S: {
|
839
|
-
g:0,
|
840
|
-
c:null,
|
841
|
-
s:"(?:st|nd|rd|th)"
|
842
|
-
},
|
843
|
-
//</locale>
|
844
|
-
w: {
|
845
|
-
g:0,
|
846
|
-
c:null,
|
847
|
-
s:"[0-6]" // javascript day number (0 (sunday) - 6 (saturday))
|
848
|
-
},
|
849
|
-
z: {
|
850
|
-
g:1,
|
851
|
-
c:"z = parseInt(results[{0}], 10);\n",
|
852
|
-
s:"(\\d{1,3})" // day of the year (0 - 364 (365 in leap years))
|
853
|
-
},
|
854
|
-
W: {
|
855
|
-
g:0,
|
856
|
-
c:null,
|
857
|
-
s:"(?:\\d{2})" // ISO-8601 week number (with leading zero)
|
858
|
-
},
|
859
|
-
F: function() {
|
860
|
-
return {
|
861
|
-
g:1,
|
862
|
-
c:"m = parseInt(Ext.Date.getMonthNumber(results[{0}]), 10);\n", // get localised month number
|
863
|
-
s:"(" + utilDate.monthNames.join("|") + ")"
|
864
|
-
};
|
865
|
-
},
|
866
|
-
M: function() {
|
867
|
-
for (var a = [], i = 0; i < 12; a.push(utilDate.getShortMonthName(i)), ++i); // get localised short month names
|
868
|
-
return Ext.applyIf({
|
869
|
-
s:"(" + a.join("|") + ")"
|
870
|
-
}, utilDate.formatCodeToRegex("F"));
|
871
|
-
},
|
872
|
-
m: {
|
873
|
-
g:1,
|
874
|
-
c:"m = parseInt(results[{0}], 10) - 1;\n",
|
875
|
-
s:"(1[0-2]|0[1-9])" // month number with leading zeros (01 - 12)
|
876
|
-
},
|
877
|
-
n: {
|
878
|
-
g:1,
|
879
|
-
c:"m = parseInt(results[{0}], 10) - 1;\n",
|
880
|
-
s:"(1[0-2]|[1-9])" // month number without leading zeros (1 - 12)
|
881
|
-
},
|
882
|
-
t: {
|
883
|
-
g:0,
|
884
|
-
c:null,
|
885
|
-
s:"(?:\\d{2})" // no. of days in the month (28 - 31)
|
886
|
-
},
|
887
|
-
L: {
|
888
|
-
g:0,
|
889
|
-
c:null,
|
890
|
-
s:"(?:1|0)"
|
891
|
-
},
|
892
|
-
o: function() {
|
893
|
-
return utilDate.formatCodeToRegex("Y");
|
894
|
-
},
|
895
|
-
Y: {
|
896
|
-
g:1,
|
897
|
-
c:"y = parseInt(results[{0}], 10);\n",
|
898
|
-
s:"(\\d{4})" // 4-digit year
|
899
|
-
},
|
900
|
-
y: {
|
901
|
-
g:1,
|
902
|
-
c:"var ty = parseInt(results[{0}], 10);\n"
|
903
|
-
+ "y = ty > Ext.Date.y2kYear ? 1900 + ty : 2000 + ty;\n", // 2-digit year
|
904
|
-
s:"(\\d{1,2})"
|
905
|
-
},
|
906
|
-
/*
|
907
|
-
* In the am/pm parsing routines, we allow both upper and lower case
|
908
|
-
* even though it doesn't exactly match the spec. It gives much more flexibility
|
909
|
-
* in being able to specify case insensitive regexes.
|
910
|
-
*/
|
911
|
-
//<locale type="object" property="parseCodes">
|
912
|
-
a: {
|
913
|
-
g:1,
|
914
|
-
c:"if (/(am)/i.test(results[{0}])) {\n"
|
915
|
-
+ "if (!h || h == 12) { h = 0; }\n"
|
916
|
-
+ "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
|
917
|
-
s:"(am|pm|AM|PM)",
|
918
|
-
calcAtEnd: true
|
919
|
-
},
|
920
|
-
//</locale>
|
921
|
-
//<locale type="object" property="parseCodes">
|
922
|
-
A: {
|
923
|
-
g:1,
|
924
|
-
c:"if (/(am)/i.test(results[{0}])) {\n"
|
925
|
-
+ "if (!h || h == 12) { h = 0; }\n"
|
926
|
-
+ "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
|
927
|
-
s:"(AM|PM|am|pm)",
|
928
|
-
calcAtEnd: true
|
929
|
-
},
|
930
|
-
//</locale>
|
931
|
-
g: {
|
932
|
-
g:1,
|
933
|
-
c:"h = parseInt(results[{0}], 10);\n",
|
934
|
-
s:"(1[0-2]|[0-9])" // 12-hr format of an hour without leading zeroes (1 - 12)
|
935
|
-
},
|
936
|
-
G: {
|
937
|
-
g:1,
|
938
|
-
c:"h = parseInt(results[{0}], 10);\n",
|
939
|
-
s:"(2[0-3]|1[0-9]|[0-9])" // 24-hr format of an hour without leading zeroes (0 - 23)
|
940
|
-
},
|
941
|
-
h: {
|
942
|
-
g:1,
|
943
|
-
c:"h = parseInt(results[{0}], 10);\n",
|
944
|
-
s:"(1[0-2]|0[1-9])" // 12-hr format of an hour with leading zeroes (01 - 12)
|
945
|
-
},
|
946
|
-
H: {
|
947
|
-
g:1,
|
948
|
-
c:"h = parseInt(results[{0}], 10);\n",
|
949
|
-
s:"(2[0-3]|[0-1][0-9])" // 24-hr format of an hour with leading zeroes (00 - 23)
|
950
|
-
},
|
951
|
-
i: {
|
952
|
-
g:1,
|
953
|
-
c:"i = parseInt(results[{0}], 10);\n",
|
954
|
-
s:"([0-5][0-9])" // minutes with leading zeros (00 - 59)
|
955
|
-
},
|
956
|
-
s: {
|
957
|
-
g:1,
|
958
|
-
c:"s = parseInt(results[{0}], 10);\n",
|
959
|
-
s:"([0-5][0-9])" // seconds with leading zeros (00 - 59)
|
960
|
-
},
|
961
|
-
u: {
|
962
|
-
g:1,
|
963
|
-
c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
|
964
|
-
s:"(\\d+)" // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)
|
965
|
-
},
|
966
|
-
O: {
|
967
|
-
g:1,
|
968
|
-
c:[
|
969
|
-
"o = results[{0}];",
|
970
|
-
"var sn = o.substring(0,1),", // get + / - sign
|
971
|
-
"hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),", // get hours (performs minutes-to-hour conversion also, just in case)
|
972
|
-
"mn = o.substring(3,5) % 60;", // get minutes
|
973
|
-
"o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs
|
974
|
-
].join("\n"),
|
975
|
-
s: "([+-]\\d{4})" // GMT offset in hrs and mins
|
976
|
-
},
|
977
|
-
P: {
|
978
|
-
g:1,
|
979
|
-
c:[
|
980
|
-
"o = results[{0}];",
|
981
|
-
"var sn = o.substring(0,1),", // get + / - sign
|
982
|
-
"hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),", // get hours (performs minutes-to-hour conversion also, just in case)
|
983
|
-
"mn = o.substring(4,6) % 60;", // get minutes
|
984
|
-
"o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs
|
985
|
-
].join("\n"),
|
986
|
-
s: "([+-]\\d{2}:\\d{2})" // GMT offset in hrs and mins (with colon separator)
|
987
|
-
},
|
988
|
-
T: {
|
989
|
-
g:0,
|
990
|
-
c:null,
|
991
|
-
s:"[A-Z]{1,4}" // timezone abbrev. may be between 1 - 4 chars
|
992
|
-
},
|
993
|
-
Z: {
|
994
|
-
g:1,
|
995
|
-
c:"zz = results[{0}] * 1;\n" // -43200 <= UTC offset <= 50400
|
996
|
-
+ "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
|
997
|
-
s:"([+-]?\\d{1,5})" // leading '+' sign is optional for UTC offset
|
998
|
-
},
|
999
|
-
c: function() {
|
1000
|
-
var calc = [],
|
1001
|
-
arr = [
|
1002
|
-
utilDate.formatCodeToRegex("Y", 1), // year
|
1003
|
-
utilDate.formatCodeToRegex("m", 2), // month
|
1004
|
-
utilDate.formatCodeToRegex("d", 3), // day
|
1005
|
-
utilDate.formatCodeToRegex("H", 4), // hour
|
1006
|
-
utilDate.formatCodeToRegex("i", 5), // minute
|
1007
|
-
utilDate.formatCodeToRegex("s", 6), // second
|
1008
|
-
{c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"}, // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)
|
1009
|
-
{c:[ // allow either "Z" (i.e. UTC) or "-0530" or "+08:00" (i.e. UTC offset) timezone delimiters. assumes local timezone if no timezone is specified
|
1010
|
-
"if(results[8]) {", // timezone specified
|
1011
|
-
"if(results[8] == 'Z'){",
|
1012
|
-
"zz = 0;", // UTC
|
1013
|
-
"}else if (results[8].indexOf(':') > -1){",
|
1014
|
-
utilDate.formatCodeToRegex("P", 8).c, // timezone offset with colon separator
|
1015
|
-
"}else{",
|
1016
|
-
utilDate.formatCodeToRegex("O", 8).c, // timezone offset without colon separator
|
1017
|
-
"}",
|
1018
|
-
"}"
|
1019
|
-
].join('\n')}
|
1020
|
-
],
|
1021
|
-
i,
|
1022
|
-
l;
|
1023
|
-
|
1024
|
-
for (i = 0, l = arr.length; i < l; ++i) {
|
1025
|
-
calc.push(arr[i].c);
|
1026
|
-
}
|
1027
|
-
|
1028
|
-
return {
|
1029
|
-
g:1,
|
1030
|
-
c:calc.join(""),
|
1031
|
-
s:[
|
1032
|
-
arr[0].s, // year (required)
|
1033
|
-
"(?:", "-", arr[1].s, // month (optional)
|
1034
|
-
"(?:", "-", arr[2].s, // day (optional)
|
1035
|
-
"(?:",
|
1036
|
-
"(?:T| )?", // time delimiter -- either a "T" or a single blank space
|
1037
|
-
arr[3].s, ":", arr[4].s, // hour AND minute, delimited by a single colon (optional). MUST be preceded by either a "T" or a single blank space
|
1038
|
-
"(?::", arr[5].s, ")?", // seconds (optional)
|
1039
|
-
"(?:(?:\\.|,)(\\d+))?", // decimal fraction of a second (e.g. ",12345" or ".98765") (optional)
|
1040
|
-
"(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?", // "Z" (UTC) or "-0530" (UTC offset without colon delimiter) or "+08:00" (UTC offset with colon delimiter) (optional)
|
1041
|
-
")?",
|
1042
|
-
")?",
|
1043
|
-
")?"
|
1044
|
-
].join("")
|
1045
|
-
};
|
1046
|
-
},
|
1047
|
-
U: {
|
1048
|
-
g:1,
|
1049
|
-
c:"u = parseInt(results[{0}], 10);\n",
|
1050
|
-
s:"(-?\\d+)" // leading minus sign indicates seconds before UNIX epoch
|
1051
|
-
}
|
1052
|
-
},
|
1053
|
-
|
1054
|
-
//Old Ext.Date prototype methods.
|
1055
|
-
// private
|
1056
|
-
dateFormat: function(date, format) {
|
1057
|
-
return utilDate.format(date, format);
|
1058
|
-
},
|
1059
|
-
|
1060
|
-
/**
|
1061
|
-
* Compares if two dates are equal by comparing their values.
|
1062
|
-
* @param {Date} date1
|
1063
|
-
* @param {Date} date2
|
1064
|
-
* @return {Boolean} True if the date values are equal
|
1065
|
-
*/
|
1066
|
-
isEqual: function(date1, date2) {
|
1067
|
-
// check we have 2 date objects
|
1068
|
-
if (date1 && date2) {
|
1069
|
-
return (date1.getTime() === date2.getTime());
|
1070
|
-
}
|
1071
|
-
// one or both isn't a date, only equal if both are falsey
|
1072
|
-
return !(date1 || date2);
|
1073
|
-
},
|
1074
|
-
|
1075
|
-
/**
|
1076
|
-
* Formats a date given the supplied format string.
|
1077
|
-
* @param {Date} date The date to format
|
1078
|
-
* @param {String} format The format string
|
1079
|
-
* @return {String} The formatted date or an empty string if date parameter is not a JavaScript Date object
|
1080
|
-
*/
|
1081
|
-
format: function(date, format) {
|
1082
|
-
var formatFunctions = utilDate.formatFunctions;
|
1083
|
-
|
1084
|
-
if (!Ext.isDate(date)) {
|
1085
|
-
return '';
|
1086
|
-
}
|
1087
|
-
|
1088
|
-
if (formatFunctions[format] == null) {
|
1089
|
-
utilDate.createFormat(format);
|
1090
|
-
}
|
1091
|
-
|
1092
|
-
return formatFunctions[format].call(date) + '';
|
1093
|
-
},
|
1094
|
-
|
1095
|
-
/**
|
1096
|
-
* Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').
|
1097
|
-
*
|
1098
|
-
* Note: The date string returned by the javascript Date object's toString() method varies
|
1099
|
-
* between browsers (e.g. FF vs IE) and system region settings (e.g. IE in Asia vs IE in America).
|
1100
|
-
* For a given date string e.g. "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)",
|
1101
|
-
* getTimezone() first tries to get the timezone abbreviation from between a pair of parentheses
|
1102
|
-
* (which may or may not be present), failing which it proceeds to get the timezone abbreviation
|
1103
|
-
* from the GMT offset portion of the date string.
|
1104
|
-
* @param {Date} date The date
|
1105
|
-
* @return {String} The abbreviated timezone name (e.g. 'CST', 'PDT', 'EDT', 'MPST' ...).
|
1106
|
-
*/
|
1107
|
-
getTimezone : function(date) {
|
1108
|
-
// the following list shows the differences between date strings from different browsers on a WinXP SP2 machine from an Asian locale:
|
1109
|
-
//
|
1110
|
-
// Opera : "Thu, 25 Oct 2007 22:53:45 GMT+0800" -- shortest (weirdest) date string of the lot
|
1111
|
-
// Safari : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone (same as FF)
|
1112
|
-
// FF : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone
|
1113
|
-
// IE : "Thu Oct 25 22:54:35 UTC+0800 2007" -- (Asian system setting) look for 3-4 letter timezone abbrev
|
1114
|
-
// IE : "Thu Oct 25 17:06:37 PDT 2007" -- (American system setting) look for 3-4 letter timezone abbrev
|
1115
|
-
//
|
1116
|
-
// this crazy regex attempts to guess the correct timezone abbreviation despite these differences.
|
1117
|
-
// step 1: (?:\((.*)\) -- find timezone in parentheses
|
1118
|
-
// step 2: ([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?) -- if nothing was found in step 1, find timezone from timezone offset portion of date string
|
1119
|
-
// step 3: remove all non uppercase characters found in step 1 and 2
|
1120
|
-
return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
|
1121
|
-
},
|
1122
|
-
|
1123
|
-
/**
|
1124
|
-
* Get the offset from GMT of the current date (equivalent to the format specifier 'O').
|
1125
|
-
* @param {Date} date The date
|
1126
|
-
* @param {Boolean} colon (optional) true to separate the hours and minutes with a colon (defaults to false).
|
1127
|
-
* @return {String} The 4-character offset string prefixed with + or - (e.g. '-0600').
|
1128
|
-
*/
|
1129
|
-
getGMTOffset : function(date, colon) {
|
1130
|
-
var offset = date.getTimezoneOffset();
|
1131
|
-
return (offset > 0 ? "-" : "+")
|
1132
|
-
+ Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0")
|
1133
|
-
+ (colon ? ":" : "")
|
1134
|
-
+ Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
|
1135
|
-
},
|
1136
|
-
|
1137
|
-
/**
|
1138
|
-
* Get the numeric day number of the year, adjusted for leap year.
|
1139
|
-
* @param {Date} date The date
|
1140
|
-
* @return {Number} 0 to 364 (365 in leap years).
|
1141
|
-
*/
|
1142
|
-
getDayOfYear: function(date) {
|
1143
|
-
var num = 0,
|
1144
|
-
d = Ext.Date.clone(date),
|
1145
|
-
m = date.getMonth(),
|
1146
|
-
i;
|
1147
|
-
|
1148
|
-
for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
|
1149
|
-
num += utilDate.getDaysInMonth(d);
|
1150
|
-
}
|
1151
|
-
return num + date.getDate() - 1;
|
1152
|
-
},
|
1153
|
-
|
1154
|
-
/**
|
1155
|
-
* Get the numeric ISO-8601 week number of the year.
|
1156
|
-
* (equivalent to the format specifier 'W', but without a leading zero).
|
1157
|
-
* @param {Date} date The date
|
1158
|
-
* @return {Number} 1 to 53
|
1159
|
-
* @method
|
1160
|
-
*/
|
1161
|
-
getWeekOfYear : (function() {
|
1162
|
-
// adapted from http://www.merlyn.demon.co.uk/weekcalc.htm
|
1163
|
-
var ms1d = 864e5, // milliseconds in a day
|
1164
|
-
ms7d = 7 * ms1d; // milliseconds in a week
|
1165
|
-
|
1166
|
-
return function(date) { // return a closure so constants get calculated only once
|
1167
|
-
var DC3 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d, // an Absolute Day Number
|
1168
|
-
AWN = Math.floor(DC3 / 7), // an Absolute Week Number
|
1169
|
-
Wyr = new Date(AWN * ms7d).getUTCFullYear();
|
1170
|
-
|
1171
|
-
return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
|
1172
|
-
};
|
1173
|
-
}()),
|
1174
|
-
|
1175
|
-
/**
|
1176
|
-
* Checks if the current date falls within a leap year.
|
1177
|
-
* @param {Date} date The date
|
1178
|
-
* @return {Boolean} True if the current date falls within a leap year, false otherwise.
|
1179
|
-
*/
|
1180
|
-
isLeapYear : function(date) {
|
1181
|
-
var year = date.getFullYear();
|
1182
|
-
return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
|
1183
|
-
},
|
1184
|
-
|
1185
|
-
/**
|
1186
|
-
* Get the first day of the current month, adjusted for leap year. The returned value
|
1187
|
-
* is the numeric day index within the week (0-6) which can be used in conjunction with
|
1188
|
-
* the {@link #monthNames} array to retrieve the textual day name.
|
1189
|
-
* Example:
|
1190
|
-
* <pre><code>
|
1191
|
-
var dt = new Date('1/10/2007'),
|
1192
|
-
firstDay = Ext.Date.getFirstDayOfMonth(dt);
|
1193
|
-
console.log(Ext.Date.dayNames[firstDay]); //output: 'Monday'
|
1194
|
-
* </code></pre>
|
1195
|
-
* @param {Date} date The date
|
1196
|
-
* @return {Number} The day number (0-6).
|
1197
|
-
*/
|
1198
|
-
getFirstDayOfMonth : function(date) {
|
1199
|
-
var day = (date.getDay() - (date.getDate() - 1)) % 7;
|
1200
|
-
return (day < 0) ? (day + 7) : day;
|
1201
|
-
},
|
1202
|
-
|
1203
|
-
/**
|
1204
|
-
* Get the last day of the current month, adjusted for leap year. The returned value
|
1205
|
-
* is the numeric day index within the week (0-6) which can be used in conjunction with
|
1206
|
-
* the {@link #monthNames} array to retrieve the textual day name.
|
1207
|
-
* Example:
|
1208
|
-
* <pre><code>
|
1209
|
-
var dt = new Date('1/10/2007'),
|
1210
|
-
lastDay = Ext.Date.getLastDayOfMonth(dt);
|
1211
|
-
console.log(Ext.Date.dayNames[lastDay]); //output: 'Wednesday'
|
1212
|
-
* </code></pre>
|
1213
|
-
* @param {Date} date The date
|
1214
|
-
* @return {Number} The day number (0-6).
|
1215
|
-
*/
|
1216
|
-
getLastDayOfMonth : function(date) {
|
1217
|
-
return utilDate.getLastDateOfMonth(date).getDay();
|
1218
|
-
},
|
1219
|
-
|
1220
|
-
|
1221
|
-
/**
|
1222
|
-
* Get the date of the first day of the month in which this date resides.
|
1223
|
-
* @param {Date} date The date
|
1224
|
-
* @return {Date}
|
1225
|
-
*/
|
1226
|
-
getFirstDateOfMonth : function(date) {
|
1227
|
-
return new Date(date.getFullYear(), date.getMonth(), 1);
|
1228
|
-
},
|
1229
|
-
|
1230
|
-
/**
|
1231
|
-
* Get the date of the last day of the month in which this date resides.
|
1232
|
-
* @param {Date} date The date
|
1233
|
-
* @return {Date}
|
1234
|
-
*/
|
1235
|
-
getLastDateOfMonth : function(date) {
|
1236
|
-
return new Date(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
|
1237
|
-
},
|
1238
|
-
|
1239
|
-
/**
|
1240
|
-
* Get the number of days in the current month, adjusted for leap year.
|
1241
|
-
* @param {Date} date The date
|
1242
|
-
* @return {Number} The number of days in the month.
|
1243
|
-
* @method
|
1244
|
-
*/
|
1245
|
-
getDaysInMonth: (function() {
|
1246
|
-
var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
1247
|
-
|
1248
|
-
return function(date) { // return a closure for efficiency
|
1249
|
-
var m = date.getMonth();
|
1250
|
-
|
1251
|
-
return m == 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
|
1252
|
-
};
|
1253
|
-
}()),
|
1254
|
-
|
1255
|
-
//<locale type="function">
|
1256
|
-
/**
|
1257
|
-
* Get the English ordinal suffix of the current day (equivalent to the format specifier 'S').
|
1258
|
-
* @param {Date} date The date
|
1259
|
-
* @return {String} 'st, 'nd', 'rd' or 'th'.
|
1260
|
-
*/
|
1261
|
-
getSuffix : function(date) {
|
1262
|
-
switch (date.getDate()) {
|
1263
|
-
case 1:
|
1264
|
-
case 21:
|
1265
|
-
case 31:
|
1266
|
-
return "st";
|
1267
|
-
case 2:
|
1268
|
-
case 22:
|
1269
|
-
return "nd";
|
1270
|
-
case 3:
|
1271
|
-
case 23:
|
1272
|
-
return "rd";
|
1273
|
-
default:
|
1274
|
-
return "th";
|
1275
|
-
}
|
1276
|
-
},
|
1277
|
-
//</locale>
|
1278
|
-
|
1279
|
-
/**
|
1280
|
-
* Creates and returns a new Date instance with the exact same date value as the called instance.
|
1281
|
-
* Dates are copied and passed by reference, so if a copied date variable is modified later, the original
|
1282
|
-
* variable will also be changed. When the intention is to create a new variable that will not
|
1283
|
-
* modify the original instance, you should create a clone.
|
1284
|
-
*
|
1285
|
-
* Example of correctly cloning a date:
|
1286
|
-
* <pre><code>
|
1287
|
-
//wrong way:
|
1288
|
-
var orig = new Date('10/1/2006');
|
1289
|
-
var copy = orig;
|
1290
|
-
copy.setDate(5);
|
1291
|
-
console.log(orig); //returns 'Thu Oct 05 2006'!
|
1292
|
-
|
1293
|
-
//correct way:
|
1294
|
-
var orig = new Date('10/1/2006'),
|
1295
|
-
copy = Ext.Date.clone(orig);
|
1296
|
-
copy.setDate(5);
|
1297
|
-
console.log(orig); //returns 'Thu Oct 01 2006'
|
1298
|
-
* </code></pre>
|
1299
|
-
* @param {Date} date The date
|
1300
|
-
* @return {Date} The new Date instance.
|
1301
|
-
*/
|
1302
|
-
clone : function(date) {
|
1303
|
-
return new Date(date.getTime());
|
1304
|
-
},
|
1305
|
-
|
1306
|
-
/**
|
1307
|
-
* Checks if the current date is affected by Daylight Saving Time (DST).
|
1308
|
-
* @param {Date} date The date
|
1309
|
-
* @return {Boolean} True if the current date is affected by DST.
|
1310
|
-
*/
|
1311
|
-
isDST : function(date) {
|
1312
|
-
// adapted from http://sencha.com/forum/showthread.php?p=247172#post247172
|
1313
|
-
// courtesy of @geoffrey.mcgill
|
1314
|
-
return new Date(date.getFullYear(), 0, 1).getTimezoneOffset() != date.getTimezoneOffset();
|
1315
|
-
},
|
1316
|
-
|
1317
|
-
/**
|
1318
|
-
* Attempts to clear all time information from this Date by setting the time to midnight of the same day,
|
1319
|
-
* automatically adjusting for Daylight Saving Time (DST) where applicable.
|
1320
|
-
* (note: DST timezone information for the browser's host operating system is assumed to be up-to-date)
|
1321
|
-
* @param {Date} date The date
|
1322
|
-
* @param {Boolean} clone true to create a clone of this date, clear the time and return it (defaults to false).
|
1323
|
-
* @return {Date} this or the clone.
|
1324
|
-
*/
|
1325
|
-
clearTime : function(date, clone) {
|
1326
|
-
if (clone) {
|
1327
|
-
return Ext.Date.clearTime(Ext.Date.clone(date));
|
1328
|
-
}
|
1329
|
-
|
1330
|
-
// get current date before clearing time
|
1331
|
-
var d = date.getDate(),
|
1332
|
-
hr,
|
1333
|
-
c;
|
1334
|
-
|
1335
|
-
// clear time
|
1336
|
-
date.setHours(0);
|
1337
|
-
date.setMinutes(0);
|
1338
|
-
date.setSeconds(0);
|
1339
|
-
date.setMilliseconds(0);
|
1340
|
-
|
1341
|
-
if (date.getDate() != d) { // account for DST (i.e. day of month changed when setting hour = 0)
|
1342
|
-
// note: DST adjustments are assumed to occur in multiples of 1 hour (this is almost always the case)
|
1343
|
-
// refer to http://www.timeanddate.com/time/aboutdst.html for the (rare) exceptions to this rule
|
1344
|
-
|
1345
|
-
// increment hour until cloned date == current date
|
1346
|
-
for (hr = 1, c = utilDate.add(date, Ext.Date.HOUR, hr); c.getDate() != d; hr++, c = utilDate.add(date, Ext.Date.HOUR, hr));
|
1347
|
-
|
1348
|
-
date.setDate(d);
|
1349
|
-
date.setHours(c.getHours());
|
1350
|
-
}
|
1351
|
-
|
1352
|
-
return date;
|
1353
|
-
},
|
1354
|
-
|
1355
|
-
/**
|
1356
|
-
* Provides a convenient method for performing basic date arithmetic. This method
|
1357
|
-
* does not modify the Date instance being called - it creates and returns
|
1358
|
-
* a new Date instance containing the resulting date value.
|
1359
|
-
*
|
1360
|
-
* Examples:
|
1361
|
-
* <pre><code>
|
1362
|
-
// Basic usage:
|
1363
|
-
var dt = Ext.Date.add(new Date('10/29/2006'), Ext.Date.DAY, 5);
|
1364
|
-
console.log(dt); //returns 'Fri Nov 03 2006 00:00:00'
|
1365
|
-
|
1366
|
-
// Negative values will be subtracted:
|
1367
|
-
var dt2 = Ext.Date.add(new Date('10/1/2006'), Ext.Date.DAY, -5);
|
1368
|
-
console.log(dt2); //returns 'Tue Sep 26 2006 00:00:00'
|
1369
|
-
|
1370
|
-
* </code></pre>
|
1371
|
-
*
|
1372
|
-
* @param {Date} date The date to modify
|
1373
|
-
* @param {String} interval A valid date interval enum value.
|
1374
|
-
* @param {Number} value The amount to add to the current date.
|
1375
|
-
* @return {Date} The new Date instance.
|
1376
|
-
*/
|
1377
|
-
add : function(date, interval, value) {
|
1378
|
-
var d = Ext.Date.clone(date),
|
1379
|
-
Date = Ext.Date,
|
1380
|
-
day;
|
1381
|
-
if (!interval || value === 0) {
|
1382
|
-
return d;
|
1383
|
-
}
|
1384
|
-
|
1385
|
-
switch(interval.toLowerCase()) {
|
1386
|
-
case Ext.Date.MILLI:
|
1387
|
-
d.setMilliseconds(d.getMilliseconds() + value);
|
1388
|
-
break;
|
1389
|
-
case Ext.Date.SECOND:
|
1390
|
-
d.setSeconds(d.getSeconds() + value);
|
1391
|
-
break;
|
1392
|
-
case Ext.Date.MINUTE:
|
1393
|
-
d.setMinutes(d.getMinutes() + value);
|
1394
|
-
break;
|
1395
|
-
case Ext.Date.HOUR:
|
1396
|
-
d.setHours(d.getHours() + value);
|
1397
|
-
break;
|
1398
|
-
case Ext.Date.DAY:
|
1399
|
-
d.setDate(d.getDate() + value);
|
1400
|
-
break;
|
1401
|
-
case Ext.Date.MONTH:
|
1402
|
-
day = date.getDate();
|
1403
|
-
if (day > 28) {
|
1404
|
-
day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.MONTH, value)).getDate());
|
1405
|
-
}
|
1406
|
-
d.setDate(day);
|
1407
|
-
d.setMonth(date.getMonth() + value);
|
1408
|
-
break;
|
1409
|
-
case Ext.Date.YEAR:
|
1410
|
-
day = date.getDate();
|
1411
|
-
if (day > 28) {
|
1412
|
-
day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.YEAR, value)).getDate());
|
1413
|
-
}
|
1414
|
-
d.setDate(day);
|
1415
|
-
d.setFullYear(date.getFullYear() + value);
|
1416
|
-
break;
|
1417
|
-
}
|
1418
|
-
return d;
|
1419
|
-
},
|
1420
|
-
|
1421
|
-
/**
|
1422
|
-
* Checks if a date falls on or between the given start and end dates.
|
1423
|
-
* @param {Date} date The date to check
|
1424
|
-
* @param {Date} start Start date
|
1425
|
-
* @param {Date} end End date
|
1426
|
-
* @return {Boolean} true if this date falls on or between the given start and end dates.
|
1427
|
-
*/
|
1428
|
-
between : function(date, start, end) {
|
1429
|
-
var t = date.getTime();
|
1430
|
-
return start.getTime() <= t && t <= end.getTime();
|
1431
|
-
},
|
1432
|
-
|
1433
|
-
//Maintains compatibility with old static and prototype window.Date methods.
|
1434
|
-
compat: function() {
|
1435
|
-
var nativeDate = window.Date,
|
1436
|
-
p, u,
|
1437
|
-
statics = ['useStrict', 'formatCodeToRegex', 'parseFunctions', 'parseRegexes', 'formatFunctions', 'y2kYear', 'MILLI', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'MONTH', 'YEAR', 'defaults', 'dayNames', 'monthNames', 'monthNumbers', 'getShortMonthName', 'getShortDayName', 'getMonthNumber', 'formatCodes', 'isValid', 'parseDate', 'getFormatCode', 'createFormat', 'createParser', 'parseCodes'],
|
1438
|
-
proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'],
|
1439
|
-
sLen = statics.length,
|
1440
|
-
pLen = proto.length,
|
1441
|
-
stat, prot, s;
|
1442
|
-
|
1443
|
-
//Append statics
|
1444
|
-
for (s = 0; s < sLen; s++) {
|
1445
|
-
stat = statics[s];
|
1446
|
-
nativeDate[stat] = utilDate[stat];
|
1447
|
-
}
|
1448
|
-
|
1449
|
-
//Append to prototype
|
1450
|
-
for (p = 0; p < pLen; p++) {
|
1451
|
-
prot = proto[p];
|
1452
|
-
nativeDate.prototype[prot] = function() {
|
1453
|
-
var args = Array.prototype.slice.call(arguments);
|
1454
|
-
args.unshift(this);
|
1455
|
-
return utilDate[prot].apply(utilDate, args);
|
1456
|
-
};
|
1457
|
-
}
|
1458
|
-
}
|
1459
|
-
};
|
1460
|
-
|
1461
|
-
var utilDate = Ext.Date;
|
1462
|
-
|
1463
|
-
}());
|