Skip to content

Commit

Permalink
rename toJSON so it doesn't conflict with standard toJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Oct 18, 2023
1 parent 0da99cc commit 0d4357d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions examples/date/src/index.did
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ service: () -> {
getUtcMinutes: (text) -> (nat32) query;
getUtcMonth: (text) -> (nat32) query;
getUtcSeconds: (text) -> (nat32) query;
now: () -> (nat64) query;
parse: (text) -> (nat64) query;
setDate: (text, nat32) -> (nat32) query;
setFullYear: (text, nat32) -> (nat32) query;
setHours: (text, nat32) -> (nat32) query;
Expand All @@ -34,11 +36,9 @@ service: () -> {
setUtcSeconds: (text, nat32) -> (nat32) query;
toDateString: (text) -> (text) query;
toISOString: (text) -> (text) query;
toJSON: (text) -> (text) query;
toJSONString: (text) -> (text) query;
toString: (text) -> (text) query;
toTimeString: (text) -> (text) query;
toUtcString: (text) -> (text) query;
now: () -> (nat64) query;
parse: (text) -> (nat64) query;
utc: (nat32, nat32) -> (nat64) query;
}
2 changes: 1 addition & 1 deletion examples/date/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export default Canister({
toISOString: query([text], text, (isoString) => {
return new Date(isoString).toISOString();
}),
toJSON: query([text], text, (isoString) => {
toJSONString: query([text], text, (isoString) => {
return new Date(isoString).toJSON();
}),
toString: query([text], text, (isoString) => {
Expand Down
4 changes: 3 additions & 1 deletion examples/date/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,9 @@ export function getTests(dateCanister: ActorSubclass<_SERVICE>): Test[] {
test: async () => {
const date = new Date();

const result = await dateCanister.toJSON(date.toISOString());
const result = await dateCanister.toJSONString(
date.toISOString()
);
const expected = date.toJSON();

return {
Expand Down

0 comments on commit 0d4357d

Please sign in to comment.