Sha256: b597b9b9e64566f1911d1044322d71c0c07949daf7ed37a1a68ad37d94dff8ce
Contents?: true
Size: 467 Bytes
Versions: 1
Compression:
Stored size: 467 Bytes
Contents
require 'date' module GS1 module Extensions # Extension for a GS1 date. Ensures correct formating and validation. # module Date def self.included(base) base.define :date base.define :length, barcode: 6 end def to_s return data.strftime('%y%m%d') if data.is_a?(::Date) data end def to_date return data if data.is_a?(::Date) ::Date.parse(data) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gs1-0.1.0 | lib/gs1/extensions/date.rb |