Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect dateTime.iso8601 value in the jabber-rpc request #628

Open
roman-sinelnikov opened this issue Nov 12, 2015 · 0 comments
Open

Incorrect dateTime.iso8601 value in the jabber-rpc request #628

roman-sinelnikov opened this issue Nov 12, 2015 · 0 comments

Comments

@roman-sinelnikov
Copy link

The format of the value returned by the XMPPIQ+JabberRPC::+valueElementFromDate method in XEP-0009 extension is incorrect.

Date is formatted as follows:

  +(NSXMLElement *)valueElementFromDate:(NSDate *)date {
    unsigned calendarComponents =   kCFCalendarUnitYear | 
    kCFCalendarUnitMonth | 
    kCFCalendarUnitDay | 
    kCFCalendarUnitHour | 
    kCFCalendarUnitMinute | 
    kCFCalendarUnitSecond;
    NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:calendarComponents fromDate:date];

    NSString *dateString = [NSString stringWithFormat: @"%.4ld%.2ld%.2ldT%.2ld:%.2ld:%.2ld", 
                            (long)[dateComponents year],
                            (long)[dateComponents month],
                            (long)[dateComponents day],
                            (long)[dateComponents hour],
                            (long)[dateComponents minute],
                            (long)[dateComponents second], nil];

    return [self valueElementFromElementWithName:@"dateTime.iso8601" value: dateString];
}

BUT here http://xmpp.org/extensions/xep-0009.html
dateTime.iso8601 described as xs:dateTime type.

And here http://www.w3schools.com/schema/schema_dtypes_date.asp xs:dateTime type described as
string in 'YYYY-MM-DDThh:mm:ss' format.

I've noticed that server I'm working with returns an error when I try to send a request with such date value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant