summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArtem Kozaev <[email protected]>2020-11-27 17:55:17 +0300
committerArtem Kozaev <[email protected]>2020-11-27 17:55:17 +0300
commit93ecd05c7ad587a60361b042ab9d692391e40e3b (patch)
tree3c4b6ec016eae8c4e795184e222be1468ddc6171
parente4aeec68c8b7bb699db876df375a1e98187b21ac (diff)
downloadcaxlsx-93ecd05c7ad587a60361b042ab9d692391e40e3b.tar.gz
caxlsx-93ecd05c7ad587a60361b042ab9d692391e40e3b.zip
Allow to set cell type to `date`
-rw-r--r--lib/axlsx/util/validators.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/data_validation.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index 76ee2250..f1bf0ffc 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -269,7 +269,7 @@ module Axlsx
# valid types must be one of custom, data, decimal, list, none, textLength, time, whole
# @param [Any] v The value validated
def self.validate_data_validation_type(v)
- RestrictionValidator.validate :data_validation_type, [:custom, :data, :decimal, :list, :none, :textLength, :time, :whole], v
+ RestrictionValidator.validate :data_validation_type, [:custom, :data, :decimal, :list, :none, :textLength, :date, :time, :whole], v
end
# Requires that the value is a valid sheet view type.
diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb
index ab018695..1c5f5051 100644
--- a/lib/axlsx/workbook/worksheet/data_validation.rb
+++ b/lib/axlsx/workbook/worksheet/data_validation.rb
@@ -171,7 +171,7 @@ module Axlsx
def formula1=(v); Axlsx::validate_string(v); @formula1 = v end
# @see formula2
- def formula2=(v); Axlsx::validate_string(v); @formula2 = v end
+ def formula2=(v); Axlsx::validate_string(v); @formula2 = v end
# @see allowBlank
def allowBlank=(v); Axlsx::validate_boolean(v); @allowBlank = v end
@@ -216,8 +216,8 @@ module Axlsx
valid_attributes = get_valid_attributes
str << '<dataValidation '
- str << instance_values.map do |key, value|
- '' << key << '="' << Axlsx.booleanize(value).to_s << '"' if (valid_attributes.include?(key.to_sym) && !CHILD_ELEMENTS.include?(key.to_sym))
+ str << instance_values.map do |key, value|
+ '' << key << '="' << Axlsx.booleanize(value).to_s << '"' if (valid_attributes.include?(key.to_sym) && !CHILD_ELEMENTS.include?(key.to_sym))
end.join(' ')
str << '>'
str << ('<formula1>' << self.formula1 << '</formula1>') if @formula1 and valid_attributes.include?(:formula1)
@@ -229,7 +229,7 @@ module Axlsx
def get_valid_attributes
attributes = [:allowBlank, :error, :errorStyle, :errorTitle, :prompt, :promptTitle, :showErrorMessage, :showInputMessage, :sqref, :type ]
- if [:whole, :decimal, :data, :time, :textLength].include?(@type)
+ if [:whole, :decimal, :data, :time, :date, :textLength].include?(@type)
attributes << [:operator, :formula1]
attributes << [:formula2] if [:between, :notBetween].include?(@operator)
elsif @type == :list