Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:54:30+00:00 2026-06-01T02:54:30+00:00

How does upshot.js handles DateTime objects? As it seems its just creating normal strings

  • 0

How does upshot.js handles DateTime objects?

As it seems its just creating “normal” strings and not creating a real JS date object.

All the problems related to JSON date formatting and MVC are discussed here already:
Handling dates with Asp.Net MVC and KnockoutJS

So even after changing the MVC default JSON formatter to JSON.Net its still not doing an automatic conversion to date.
Unfortunately all the bindings must be done “per hand” to create a Date object internally. With the JSON.Net formatted date to new Date(string) approach seems to work ok as the constructor is abel to handle the date formatstring perfect.

Is there a “general” lib available for handling all the different value types in bindings for knockout?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:54:32+00:00Added an answer on June 1, 2026 at 2:54 am

    This is an old story, due to the fact that json has no default format for dates. Moreover, the format /Date(…..)/ pretended by .Net (.Net not just asp.net) is not easy to handle also with the json customization allowed by all modern browsers:

    1. The first problem is that the /Date(…..)/ format is not understood by the browser json parsing function. This is easily resolved by customizing Json parsing. There are a lot of patches on the net.
    2. You have the same problem when sending back the date to the server. However in this case it is very difficult to patch because while the JSON.stringify method accept a function to customize json serialization, if you pass a function that transform each date into the string “/Date(…..)/”…then the stringify function ADD furteh \ and transform it into: “\/Date(…..)\/”, that is it escapes the \ char….but the string transformed this way is not understood by dotnet. On the other side if you transform dates into /Date(…..)/…no escape char is added so…also in this case you get a wrong encoding.
    3. Also if you solve the above problems…after a round trip server/client/server the date returns changed. Specifically the timeline offset is subtracted from the original date…This is due to the different ways .Net and browsers handle Timelines.
    4. upshot just calls the browser JSON.stringify function…so it leave you no room for customizing dates.

    if you use the client blocks feature of the Mvc Controls Toolkit project(I am the coordinator of) you can use an “enhanced” knockout that handles automatically problems 1 and 2. In the next release to come in a few days I will add also the automatic handling of problem 3.
    However…this WILL NOT SOLVE the problem of upshot…since I hooked the mapping functions of the knokout mapping plugin that are not used by upshot to send data back on the server…and since upshot calls directly JSON.stringify…there seems to be no way to fix the problem…other than modifying upshot to handle json custom formats when posting data.

    In the upcomig release of Client Blocks I will provide an UpdateManager class that do a job “similar” to upshot that handle properly dates…However this will never be a substitute for upshot since it uses a quite different update strategy…and is just an option MORE not a substitute.
    So I hope that in the final release of upshot there will be the possibility to customize the json formatting of data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does C# have built-in support for parsing strings of page numbers? By page numbers,
Does anyone have a definitive answer to whether Sql Server Management Objects is compatible
Does anyone know if when creating a mutex, it's a must to initialize it
Does Google force employees who have offers from Facebook to leave immediately?
Does anyone remember the XMP tag? What was it used for and why was
Does the Java language have delegate features, similar to how C# has support for
Does anybody know any good resources for learning how to program CIL with in-depth
Does anyone know how to get IntelliSense to work reliably when working in C/C++
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone use have a good regex library that they like to use? Most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.