spree 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/CHANGELOG +4 -0
- data/Rakefile +7 -1
- data/config/database.yml +36 -9
- data/config/environment.rb +1 -1
- data/db/schema.rb +93 -50
- data/lib/spree.rb +1 -1
- data/public/images/openid-inputicon.gif +0 -0
- data/public/javascripts/calendar_date_select/format_db.js +27 -0
- data/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
- data/public/javascripts/calendar_date_select/format_iso_date.js +46 -0
- data/public/javascripts/calendar_date_select/locale/de.js +11 -0
- data/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/public/javascripts/calendar_date_select/locale/fr.js +10 -0
- data/public/javascripts/calendar_date_select/locale/pl.js +10 -0
- data/public/javascripts/calendar_date_select/locale/pt.js +11 -0
- data/public/javascripts/calendar_date_select/locale/ru.js +10 -0
- data/public/stylesheets/compiled/screen.css +42 -16
- metadata +38 -17
- data/public/assets/layouts/6/original/Picture_1.png +0 -0
- data/public/images/flags/dk.png +0 -0
- data/public/stylesheets/compiled/buttons.css +0 -70
- data/public/stylesheets/compiled/cart.css +0 -69
- data/public/stylesheets/compiled/checkout.css +0 -79
- data/public/stylesheets/compiled/colors.css +0 -0
- data/public/stylesheets/compiled/compare_products.css +0 -14
- data/public/stylesheets/compiled/layout.css +0 -79
- data/public/stylesheets/compiled/messages.css +0 -69
- data/public/stylesheets/compiled/mixins.css +0 -0
- data/public/stylesheets/compiled/navigation.css +0 -69
- data/public/stylesheets/compiled/prices.css +0 -81
- data/public/stylesheets/compiled/product_detail.css +0 -78
- data/public/stylesheets/compiled/product_thumbnail.css +0 -69
- data/public/stylesheets/compiled/registration.css +0 -69
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -37,7 +37,12 @@ begin
|
|
37
37
|
s.add_dependency 'tlsmail', '= 0.0.1'
|
38
38
|
s.add_dependency 'rspec', '>= 1.2.0'
|
39
39
|
s.add_dependency 'rspec-rails', '>= 1.2.0'
|
40
|
-
s.add_dependency 'searchlogic', ">=2.3.5"
|
40
|
+
s.add_dependency 'searchlogic', ">=2.3.5"
|
41
|
+
s.has_rdoc = true
|
42
|
+
rdoc_excludes = Dir["**"].reject { |f| !File.directory? f }
|
43
|
+
rdoc_excludes.each do |e|
|
44
|
+
s.rdoc_options << '--exclude' << e
|
45
|
+
end
|
41
46
|
files = FileList['**/*']
|
42
47
|
files.exclude '**/._*'
|
43
48
|
files.exclude '**/*.rej'
|
@@ -61,6 +66,7 @@ begin
|
|
61
66
|
files.exclude 'vendor/plugins/resource_controller/test/*'
|
62
67
|
s.files = files.to_a
|
63
68
|
end
|
69
|
+
Jeweler::GemcutterTasks.new
|
64
70
|
rescue LoadError
|
65
71
|
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
66
72
|
end
|
data/config/database.yml
CHANGED
@@ -3,26 +3,53 @@
|
|
3
3
|
development:
|
4
4
|
adapter: mysql
|
5
5
|
database: spree_dev
|
6
|
-
username:
|
7
|
-
password:
|
6
|
+
username: spree
|
7
|
+
password: spree
|
8
8
|
host: localhost
|
9
9
|
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
10
|
+
#development:
|
11
|
+
# adapter: postgresql
|
12
|
+
# database: spree_dev
|
13
|
+
# username: spree
|
14
|
+
# password: spree_dev
|
15
|
+
# host: localhost
|
16
|
+
|
17
|
+
#development:
|
18
|
+
# adapter: sqlite3
|
19
|
+
# database: db/development.sqlite3
|
13
20
|
|
14
21
|
test:
|
15
22
|
adapter: mysql
|
16
23
|
database: spree_test
|
17
|
-
username:
|
18
|
-
password:
|
24
|
+
username: spree
|
25
|
+
password: spree
|
19
26
|
host: localhost
|
27
|
+
|
28
|
+
staging:
|
29
|
+
#adapter: sqlite3
|
30
|
+
#database: db/staging.sqlite3
|
31
|
+
adapter: mysql
|
32
|
+
database: spree_dev
|
33
|
+
username: spree
|
34
|
+
password: spree
|
35
|
+
host: localhost
|
36
|
+
|
37
|
+
#test:
|
38
|
+
# adapter: postgresql
|
39
|
+
# database: spree_test
|
40
|
+
# username: spree
|
41
|
+
# password: spree_dev
|
42
|
+
# host: localhost
|
43
|
+
|
44
|
+
#test:
|
45
|
+
# adapter: sqlite3
|
46
|
+
# database: db/test.sqlite3
|
20
47
|
|
21
48
|
production:
|
22
49
|
adapter: sqlite3
|
23
50
|
database: db/production.sqlite3
|
24
|
-
|
25
|
-
# special mode for demo.spreehq.org (you
|
51
|
+
|
52
|
+
# special mode for demo.spreehq.org (you can ignore this)
|
26
53
|
demo:
|
27
54
|
adapter: sqlite3
|
28
55
|
database: db/production.sqlite3
|
data/config/environment.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# ENV['RAILS_ENV'] ||= 'production'
|
6
6
|
|
7
7
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
SPREE_GEM_VERSION = '0.9.
|
8
|
+
SPREE_GEM_VERSION = '0.9.4' unless defined? SPREE_GEM_VERSION
|
9
9
|
|
10
10
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
11
|
require File.join(File.dirname(__FILE__), 'boot')
|
data/db/schema.rb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
#
|
10
10
|
# It's strongly recommended to check this file into your version control system.
|
11
11
|
|
12
|
-
ActiveRecord::Schema.define(:version =>
|
12
|
+
ActiveRecord::Schema.define(:version => 20091126190904) do
|
13
13
|
|
14
14
|
create_table "addresses", :force => true do |t|
|
15
15
|
t.string "firstname"
|
@@ -30,14 +30,13 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
30
30
|
create_table "adjustments", :force => true do |t|
|
31
31
|
t.integer "order_id"
|
32
32
|
t.string "type"
|
33
|
-
t.decimal "amount", :precision => 8, :scale => 2
|
33
|
+
t.decimal "amount", :precision => 8, :scale => 2
|
34
34
|
t.string "description"
|
35
35
|
t.integer "position"
|
36
36
|
t.datetime "created_at"
|
37
37
|
t.datetime "updated_at"
|
38
38
|
t.integer "adjustment_source_id"
|
39
39
|
t.string "adjustment_source_type"
|
40
|
-
t.string "secondary_type"
|
41
40
|
end
|
42
41
|
|
43
42
|
create_table "assets", :force => true do |t|
|
@@ -53,10 +52,23 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
53
52
|
t.integer "attachment_height"
|
54
53
|
end
|
55
54
|
|
55
|
+
add_index "assets", ["viewable_id"], :name => "index_assets_on_viewable_id"
|
56
|
+
add_index "assets", ["viewable_type", "type"], :name => "index_assets_on_viewable_type_and_type"
|
57
|
+
|
58
|
+
create_table "billing_integrations", :force => true do |t|
|
59
|
+
t.string "type"
|
60
|
+
t.string "name"
|
61
|
+
t.text "description"
|
62
|
+
t.boolean "active", :default => true
|
63
|
+
t.string "environment", :default => "development"
|
64
|
+
t.datetime "created_at"
|
65
|
+
t.datetime "updated_at"
|
66
|
+
end
|
67
|
+
|
56
68
|
create_table "calculators", :force => true do |t|
|
57
69
|
t.string "type"
|
58
|
-
t.integer "calculable_id",
|
59
|
-
t.string "calculable_type", :null => false
|
70
|
+
t.integer "calculable_id", :null => false
|
71
|
+
t.string "calculable_type", :default => "", :null => false
|
60
72
|
t.datetime "created_at"
|
61
73
|
t.datetime "updated_at"
|
62
74
|
end
|
@@ -67,9 +79,9 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
67
79
|
t.string "ip_address"
|
68
80
|
t.text "special_instructions"
|
69
81
|
t.integer "bill_address_id"
|
70
|
-
t.datetime "completed_at"
|
71
82
|
t.datetime "created_at"
|
72
83
|
t.datetime "updated_at"
|
84
|
+
t.string "state"
|
73
85
|
end
|
74
86
|
|
75
87
|
create_table "configurations", :force => true do |t|
|
@@ -129,34 +141,14 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
129
141
|
t.integer "checkout_id"
|
130
142
|
end
|
131
143
|
|
132
|
-
create_table "gateway_configurations", :force => true do |t|
|
133
|
-
t.integer "gateway_id"
|
134
|
-
t.datetime "created_at"
|
135
|
-
t.datetime "updated_at"
|
136
|
-
end
|
137
|
-
|
138
|
-
create_table "gateway_option_values", :force => true do |t|
|
139
|
-
t.integer "gateway_configuration_id"
|
140
|
-
t.integer "gateway_option_id"
|
141
|
-
t.text "value"
|
142
|
-
t.datetime "created_at"
|
143
|
-
t.datetime "updated_at"
|
144
|
-
end
|
145
|
-
|
146
|
-
create_table "gateway_options", :force => true do |t|
|
147
|
-
t.string "name"
|
148
|
-
t.text "description"
|
149
|
-
t.integer "gateway_id"
|
150
|
-
t.boolean "textarea", :default => false
|
151
|
-
t.datetime "created_at"
|
152
|
-
t.datetime "updated_at"
|
153
|
-
end
|
154
|
-
|
155
144
|
create_table "gateways", :force => true do |t|
|
156
|
-
t.string "
|
145
|
+
t.string "type"
|
157
146
|
t.string "name"
|
158
147
|
t.text "description"
|
159
|
-
t.boolean "active"
|
148
|
+
t.boolean "active", :default => true
|
149
|
+
t.string "environment", :default => "development"
|
150
|
+
t.string "server", :default => "test"
|
151
|
+
t.boolean "test_mode", :default => true
|
160
152
|
t.datetime "created_at"
|
161
153
|
t.datetime "updated_at"
|
162
154
|
end
|
@@ -170,6 +162,9 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
170
162
|
t.datetime "updated_at"
|
171
163
|
end
|
172
164
|
|
165
|
+
add_index "inventory_units", ["order_id"], :name => "index_inventory_units_on_order_id"
|
166
|
+
add_index "inventory_units", ["variant_id"], :name => "index_inventory_units_on_variant_id"
|
167
|
+
|
173
168
|
create_table "line_items", :force => true do |t|
|
174
169
|
t.integer "order_id"
|
175
170
|
t.integer "variant_id"
|
@@ -182,6 +177,21 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
182
177
|
add_index "line_items", ["order_id"], :name => "index_line_items_on_order_id"
|
183
178
|
add_index "line_items", ["variant_id"], :name => "index_line_items_on_variant_id"
|
184
179
|
|
180
|
+
create_table "open_id_authentication_associations", :force => true do |t|
|
181
|
+
t.integer "issued"
|
182
|
+
t.integer "lifetime"
|
183
|
+
t.string "handle"
|
184
|
+
t.string "assoc_type"
|
185
|
+
t.binary "server_url"
|
186
|
+
t.binary "secret"
|
187
|
+
end
|
188
|
+
|
189
|
+
create_table "open_id_authentication_nonces", :force => true do |t|
|
190
|
+
t.integer "timestamp", :null => false
|
191
|
+
t.string "server_url"
|
192
|
+
t.string "salt", :default => "", :null => false
|
193
|
+
end
|
194
|
+
|
185
195
|
create_table "option_types", :force => true do |t|
|
186
196
|
t.string "name", :limit => 100
|
187
197
|
t.string "presentation", :limit => 100
|
@@ -208,6 +218,7 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
208
218
|
t.integer "option_value_id"
|
209
219
|
end
|
210
220
|
|
221
|
+
add_index "option_values_variants", ["variant_id", "option_value_id"], :name => "index_option_values_variants_on_variant_id_and_option_value_id"
|
211
222
|
add_index "option_values_variants", ["variant_id"], :name => "index_option_values_variants_on_variant_id"
|
212
223
|
|
213
224
|
create_table "orders", :force => true do |t|
|
@@ -221,6 +232,7 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
221
232
|
t.string "token"
|
222
233
|
t.decimal "adjustment_total", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
223
234
|
t.decimal "credit_total", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
235
|
+
t.datetime "completed_at"
|
224
236
|
end
|
225
237
|
|
226
238
|
add_index "orders", ["number"], :name => "index_orders_on_number"
|
@@ -235,18 +247,27 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
235
247
|
end
|
236
248
|
|
237
249
|
create_table "preferences", :force => true do |t|
|
238
|
-
t.string "attribute", :null => false
|
239
|
-
t.integer "owner_id",
|
240
|
-
t.string "owner_type", :null => false
|
250
|
+
t.string "attribute", :default => "", :null => false
|
251
|
+
t.integer "owner_id", :null => false
|
252
|
+
t.string "owner_type", :default => "", :null => false
|
241
253
|
t.integer "group_id"
|
242
254
|
t.string "group_type"
|
243
|
-
t.
|
255
|
+
t.text "value"
|
244
256
|
t.datetime "created_at"
|
245
257
|
t.datetime "updated_at"
|
246
258
|
end
|
247
259
|
|
248
260
|
add_index "preferences", ["owner_id", "owner_type", "attribute", "group_id", "group_type"], :name => "index_preferences_on_owner_and_attribute_and_preference", :unique => true
|
249
261
|
|
262
|
+
create_table "product_groups", :force => true do |t|
|
263
|
+
t.string "name"
|
264
|
+
t.string "permalink"
|
265
|
+
t.string "order"
|
266
|
+
end
|
267
|
+
|
268
|
+
add_index "product_groups", ["name"], :name => "index_product_groups_on_name"
|
269
|
+
add_index "product_groups", ["permalink"], :name => "index_product_groups_on_permalink"
|
270
|
+
|
250
271
|
create_table "product_option_types", :force => true do |t|
|
251
272
|
t.integer "product_id"
|
252
273
|
t.integer "option_type_id"
|
@@ -263,6 +284,17 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
263
284
|
t.datetime "updated_at"
|
264
285
|
end
|
265
286
|
|
287
|
+
add_index "product_properties", ["product_id"], :name => "index_product_properties_on_product_id"
|
288
|
+
|
289
|
+
create_table "product_scopes", :force => true do |t|
|
290
|
+
t.integer "product_group_id"
|
291
|
+
t.string "name"
|
292
|
+
t.text "arguments"
|
293
|
+
end
|
294
|
+
|
295
|
+
add_index "product_scopes", ["name"], :name => "index_product_scopes_on_name"
|
296
|
+
add_index "product_scopes", ["product_group_id"], :name => "index_product_scopes_on_product_group_id"
|
297
|
+
|
266
298
|
create_table "products", :force => true do |t|
|
267
299
|
t.string "name", :default => "", :null => false
|
268
300
|
t.text "description"
|
@@ -275,6 +307,7 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
275
307
|
t.datetime "deleted_at"
|
276
308
|
t.string "meta_description"
|
277
309
|
t.string "meta_keywords"
|
310
|
+
t.integer "count_on_hand", :default => 0, :null => false
|
278
311
|
end
|
279
312
|
|
280
313
|
add_index "products", ["available_on"], :name => "index_products_on_available_on"
|
@@ -292,7 +325,7 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
292
325
|
|
293
326
|
create_table "properties", :force => true do |t|
|
294
327
|
t.string "name"
|
295
|
-
t.string "presentation", :null => false
|
328
|
+
t.string "presentation", :default => "", :null => false
|
296
329
|
t.datetime "created_at"
|
297
330
|
t.datetime "updated_at"
|
298
331
|
end
|
@@ -386,25 +419,31 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
386
419
|
end
|
387
420
|
|
388
421
|
create_table "taxonomies", :force => true do |t|
|
389
|
-
t.string "name", :null => false
|
422
|
+
t.string "name", :default => "", :null => false
|
390
423
|
t.datetime "created_at"
|
391
424
|
t.datetime "updated_at"
|
392
425
|
end
|
393
426
|
|
394
427
|
create_table "taxons", :force => true do |t|
|
395
|
-
t.integer "taxonomy_id",
|
428
|
+
t.integer "taxonomy_id", :null => false
|
396
429
|
t.integer "parent_id"
|
397
430
|
t.integer "position", :default => 0
|
398
|
-
t.string "name",
|
431
|
+
t.string "name", :default => "", :null => false
|
399
432
|
t.datetime "created_at"
|
400
433
|
t.datetime "updated_at"
|
401
434
|
t.string "permalink"
|
435
|
+
t.integer "lft"
|
436
|
+
t.integer "rgt"
|
402
437
|
end
|
403
438
|
|
439
|
+
add_index "taxons", ["parent_id"], :name => "index_taxons_on_parent_id"
|
440
|
+
add_index "taxons", ["permalink"], :name => "index_taxons_on_permalink"
|
441
|
+
add_index "taxons", ["taxonomy_id"], :name => "index_taxons_on_taxonomy_id"
|
442
|
+
|
404
443
|
create_table "users", :force => true do |t|
|
405
444
|
t.string "email"
|
406
|
-
t.string "crypted_password"
|
407
|
-
t.string "salt"
|
445
|
+
t.string "crypted_password"
|
446
|
+
t.string "salt"
|
408
447
|
t.string "remember_token"
|
409
448
|
t.string "remember_token_expires_at"
|
410
449
|
t.datetime "created_at"
|
@@ -412,8 +451,8 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
412
451
|
t.string "persistence_token"
|
413
452
|
t.string "single_access_token"
|
414
453
|
t.string "perishable_token"
|
415
|
-
t.integer "login_count",
|
416
|
-
t.integer "failed_login_count",
|
454
|
+
t.integer "login_count", :default => 0, :null => false
|
455
|
+
t.integer "failed_login_count", :default => 0, :null => false
|
417
456
|
t.datetime "last_request_at"
|
418
457
|
t.datetime "current_login_at"
|
419
458
|
t.datetime "last_login_at"
|
@@ -422,18 +461,22 @@ ActiveRecord::Schema.define(:version => 20090908141056) do
|
|
422
461
|
t.string "login"
|
423
462
|
t.integer "ship_address_id"
|
424
463
|
t.integer "bill_address_id"
|
464
|
+
t.string "openid_identifier"
|
425
465
|
end
|
426
466
|
|
467
|
+
add_index "users", ["openid_identifier"], :name => "index_users_on_openid_identifier"
|
468
|
+
|
427
469
|
create_table "variants", :force => true do |t|
|
428
470
|
t.integer "product_id"
|
429
|
-
t.string "sku",
|
430
|
-
t.decimal "price",
|
431
|
-
t.decimal "weight",
|
432
|
-
t.decimal "height",
|
433
|
-
t.decimal "width",
|
434
|
-
t.decimal "depth",
|
471
|
+
t.string "sku", :default => "", :null => false
|
472
|
+
t.decimal "price", :precision => 8, :scale => 2, :null => false
|
473
|
+
t.decimal "weight", :precision => 8, :scale => 2
|
474
|
+
t.decimal "height", :precision => 8, :scale => 2
|
475
|
+
t.decimal "width", :precision => 8, :scale => 2
|
476
|
+
t.decimal "depth", :precision => 8, :scale => 2
|
435
477
|
t.datetime "deleted_at"
|
436
|
-
t.boolean "is_master",
|
478
|
+
t.boolean "is_master", :default => false
|
479
|
+
t.integer "count_on_hand", :default => 0, :null => false
|
437
480
|
end
|
438
481
|
|
439
482
|
add_index "variants", ["product_id"], :name => "index_variants_on_product_id"
|
data/lib/spree.rb
CHANGED
Binary file
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// DB No Seconds Format: 2007-12-05 12:00
|
2
|
+
|
3
|
+
Date.padded2 = function(hour) { padded2 = hour.toString(); if ((parseInt(hour) < 10) || (parseInt(hour) == null)) padded2="0" + padded2; return padded2; }
|
4
|
+
Date.prototype.getAMPMHour = function() { hour=Date.padded2(this.getHours()); return (hour == null) ? 00 : (hour > 24 ? hour - 24 : hour ) }
|
5
|
+
Date.prototype.getAMPM = function() { return (this.getHours() < 12) ? "" : ""; }
|
6
|
+
|
7
|
+
Date.prototype.toFormattedString = function(include_time){
|
8
|
+
str = this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + Date.padded2(this.getDate());
|
9
|
+
if (include_time) { hour=this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() }
|
10
|
+
return str;
|
11
|
+
}
|
12
|
+
|
13
|
+
Date.parseFormattedString = function (string) {
|
14
|
+
var regexp = '([0-9]{4})-(([0-9]{1,2})-(([0-9]{1,2})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
|
15
|
+
var d = string.match(new RegExp(regexp, "i"));
|
16
|
+
if (d==null) return Date.parse(string); // at least give javascript a crack at it.
|
17
|
+
var offset = 0;
|
18
|
+
var date = new Date(d[1], 0, 1);
|
19
|
+
if (d[3]) { date.setMonth(d[3] - 1); }
|
20
|
+
if (d[5]) { date.setDate(d[5]); }
|
21
|
+
if (d[7]) {
|
22
|
+
date.setHours(parseInt(d[7], 10));
|
23
|
+
}
|
24
|
+
if (d[8]) { date.setMinutes(d[8]); }
|
25
|
+
if (d[10]) { date.setSeconds(d[10]); }
|
26
|
+
return date;
|
27
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// Formats date and time as "2000.01.20 17:00"
|
2
|
+
Date.prototype.toFormattedString = function(include_time)
|
3
|
+
{
|
4
|
+
str = this.getFullYear() + "." + Date.padded2(this.getMonth()+1) + "." + Date.padded2(this.getDate());
|
5
|
+
if (include_time) { str += " " + this.getHours() + ":" + this.getPaddedMinutes() }
|
6
|
+
return str;
|
7
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Date.prototype.toFormattedString = function(include_time) {
|
2
|
+
var hour;
|
3
|
+
var str = this.getFullYear() + "-" + Date.padded2(this.getMonth() + 1) + "-" +Date.padded2(this.getDate());
|
4
|
+
if (include_time) {
|
5
|
+
hour = this.getHours();
|
6
|
+
str += " " + this.getHours() + ":" + this.getPaddedMinutes();
|
7
|
+
}
|
8
|
+
return str;
|
9
|
+
};
|
10
|
+
|
11
|
+
Date.parseFormattedString = function (string) {
|
12
|
+
|
13
|
+
var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" +
|
14
|
+
"( ([0-9]{1,2}):([0-9]{2})?" +
|
15
|
+
"?)?)?)?";
|
16
|
+
|
17
|
+
var d = string.match(new RegExp(regexp, "i"));
|
18
|
+
if (d === null) {
|
19
|
+
return Date.parse(string); // at least give javascript a crack at it.
|
20
|
+
}
|
21
|
+
var offset = 0;
|
22
|
+
var date = new Date(d[1], 0, 1);
|
23
|
+
if (d[3]) {
|
24
|
+
date.setMonth(d[3] - 1);
|
25
|
+
}
|
26
|
+
if (d[5]) {
|
27
|
+
date.setDate(d[5]);
|
28
|
+
}
|
29
|
+
if (d[7]) {
|
30
|
+
date.setHours(d[7]);
|
31
|
+
}
|
32
|
+
if (d[8]) {
|
33
|
+
date.setMinutes(d[8]);
|
34
|
+
}
|
35
|
+
if (d[0]) {
|
36
|
+
date.setSeconds(d[0]);
|
37
|
+
}
|
38
|
+
if (d[2]) {
|
39
|
+
date.setMilliseconds(Number("0." + d[2]));
|
40
|
+
}
|
41
|
+
if (d[4]) {
|
42
|
+
offset = (Number(d[6])) + Number(d[8]);
|
43
|
+
offset = ((d[5] == '-') ? 1 : -1);
|
44
|
+
}
|
45
|
+
return date;
|
46
|
+
};
|