Skip to content

wrong datetime conversion when sending SmS #72

@junoyoon

Description

@junoyoon

https://github.com/infobip/infobip-api-java-client/blob/f6889abeb4052e6077816f06e82fff909919fb99/src/main/java/com/infobip/JSON.java#L31C1-L32C71

this datetype is wrong for SMS.
For SMS, https://www.infobip.com/docs/api/channels/sms/outbound-sms/send-message/send-sms-messages
options > schedule > sendAt parameter require yyyy-MM-dd'T'HH:mm:ss.SSSZ
this ends with 'Z' and means UTC time.

but the DateTimeFormatter in SDK 'Z' means UTC but timezone offset (RFC 822) like +0900
This causes the imcompatibility b/w SDK and infobip api.

success

curl --request POST 'https://6zjqez.api.infobip.com/email/3/send' \
...
--form 'sendAt="2026-03-12T04:59:59.123Z"'

error

curl --request POST 'https://6zjqez.api.infobip.com/email/3/send' \
...
--form 'sendAt="2026-03-12T04:59:59.123+0000"'

To fix this,
the DateTimeFomatter in https://github.com/infobip/infobip-api-java-client/blob/f6889abeb4052e6077816f06e82fff909919fb99/src/main/java/com/infobip/JSON.java#L31C1-L32C71
should be

DateTimeFormatter f = DateTimeFormatter
        .ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX")
        .withZone(ZoneOffset.UTC); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions