Azure / Azure/Azure-Functions

Date format is unnecessarily "prettified" by Cosmos DB binding

Open
#1,399 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Dear team, I'm using NodeJS to code Azure Functions.

If I use cosmos db binding to retrieve a document like this
{
"id": "91f94b58-0cca-497b-a08f-c02e73dc614b",
"publishDate":"2019-01-01T00:00:01.0000000Z"
}

What I'll receive on the JavaScript end it looks like:
{
"id": "91f94b58-0cca-497b-a08f-c02e73dc614b",
"publishDate":"2019-01-01T00:00:01Z"
}

So I noticed the "publishDate" is modified. The pattern I found is:
"2019-01-01T00:00:01.0000000Z" -> "2019-01-01T00:00:01Z"
"2019-01-01T00:00:01.1000000Z" -> "2019-01-01T00:00:01.1Z"
"2019-01-01T00:00:01.1000001Z" -> "2019-01-01T00:00:1000001Z"

I don't understand the reason behind but this "prettify" is quite problematic since Cosmos DB treat DateTime like a normal string. Actually I found out this problem because when I tried to use `publishDate={publishDate}` in the later sqlQuery it doesn't find anything ("2019-01-01T00:00:01.0000000Z" != "2019-01-01T00:00:01Z" in string comparison)

Can we keep the original date format (don't "prettify" the microsecond part), treat it as a normal string and return it?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.