Class XSD::XSDDate
In: lib/xsd/datatypes.rb
Parent: XSDAnySimpleType

Methods

_to_s   new   screen_data_str  

Included Modules

XSDDateTimeImpl

Constants

Type = QName.new(Namespace, DateLiteral)

Public Class methods

[Source]

     # File lib/xsd/datatypes.rb, line 704
704:   def initialize(value = nil)
705:     init(Type, value)
706:   end

Private Instance methods

[Source]

     # File lib/xsd/datatypes.rb, line 725
725:   def _to_s
726:     year = (@data.year > 0) ? @data.year : @data.year - 1
727:     s = format('%.4d-%02d-%02d', year, @data.mon, @data.mday)
728:     add_tz(s)
729:   end

[Source]

     # File lib/xsd/datatypes.rb, line 710
710:   def screen_data_str(t)
711:     /^([+\-]?\d{4,})-(\d\d)-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
712:     unless Regexp.last_match
713:       raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
714:     end
715:     year = $1.to_i
716:     if year < 0
717:       year += 1
718:     end
719:     mon = $2.to_i
720:     mday = $3.to_i
721:     zonestr = $4
722:     DateTime.civil(year, mon, mday, 0, 0, 0, tz2of(zonestr))
723:   end

[Validate]