Skip to content

Support for Date #35

@dselman

Description

@dselman
// @ts-ignore
@json
class Player /*extends Aged*/ {
  age: i32;
  firstName: string;
  lastName: string;
  dob: Date;
  // middleName:? string;
}

Gives the error:

> node tests

file:///Users/dan.selman/dev/cicero-asc/build/debug.js:12
          throw Error(`${message} in ${fileName}:${lineNumber}:${columnNumber}`);
                ^

Error: Could not deserialize data 2022-11-29T12:32:55.631Z to type Date. Invalide data provided. in ~lib/json-as/assembly/src/json.ts:152:13
    at file:///Users/dan.selman/dev/cicero-asc/build/debug.js:12:17
    at abort (file:///Users/dan.selman/dev/cicero-asc/build/debug.js:13:11)
    at ~lib/json-as/assembly/src/json/JSON.parseObjectValue<~lib/date/Date> (wasm://wasm/00015036:wasm-function[90]:0x1c11)
    at assembly/index/Player#__JSON_Set_Key (wasm://wasm/00015036:wasm-function[91]:0x2106)
    at ~lib/json-as/assembly/src/json/JSON.parse<assembly/index/Player> (wasm://wasm/00015036:wasm-function[92]:0x237a)
    at assembly/index/add (wasm://wasm/00015036:wasm-function[93]:0x260d)
    at export:assembly/index/add (wasm://wasm/00015036:wasm-function[98]:0x2bef)
    at add (file:///Users/dan.selman/dev/cicero-asc/build/debug.js:23:22)
    at file:///Users/dan.selman/dev/cicero-asc/tests/index.js:10:20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions