Skip to content

ietf-yang-types:date-and-time value does not meet the expectation #2045

@zhuxiaoyun138159

Description

@zhuxiaoyun138159

container interfaces {
leaf test {
type yang:date-and-time;
}
}

libyang1:
struct lyd_node *test = lyd_new_leaf(interfaces, NULL, "test", "2023-06-12T19:22:33Z");
lyd_print_mem(&buffer, interfaces, LYD_JSON, LYP_WITHSIBLINGS);
——》
buffer :{"ydb-test-common:interfaces":{"test":"2023-06-12T19:22:33Z"}}

libyang2:
struct lyd_node *test = NULL;
lyd_new_term(interfaces, NULL, "test", "2023-06-12T19:22:33Z", 0, &test);
char *buffer = NULL;
lyd_print_mem(&buffer, interfaces, LYD_JSON, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK);
——》
buffer :{"ydb-test-common:interfaces":{"test":"2023-06-13T03:22:33+08:00"}}

"2023-06-13T03:22:33+08:00" is not the value I want. I want "2023-06-12T19:22:33Z".

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:questionIssue is actually a question.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions