Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference in OffsetMomentJS between parameters in the body and in the querystring #1613

Open
jochenjonc opened this issue Sep 17, 2018 · 2 comments
Milestone

Comments

@jochenjonc
Copy link
Contributor

When generating TypeScript code with the dateTimeType set to "OffsetMomentJS" it only adjusts the offset for parameters that are in the body of a HTTP action.

this.plannedStartDate.toISOString(true)

But for parameters that are passed via the querystring the following is still used:

url_ += "start=" + encodeURIComponent(start ? "" + start.toJSON() : "") + "&";

Is it possible to change the toJSON() here to toISOString(true), keeping the offset?

@RicoSuter RicoSuter added this to the vNext milestone Oct 3, 2018
@RicoSuter
Copy link
Owner

We need to use the logic from here also for parameters:
https://github.com/RSuter/NJsonSchema/blob/8e5bc578ee740384c0b468dcb787f4c802a51e3e/src/NJsonSchema.CodeGeneration.TypeScript/DataConversionGenerator.cs#L88

Tasks:

  • Extract this internal logic so that it can also be used for params
  • Deploy new NJS package
  • Update NSwag and use this

@jochenjonc
Copy link
Contributor Author

I recently encountered the same issue, but then with moment.Duration and the conversion to TimeSpan.

Will this be fixed with the same case?

RicoSuter pushed a commit that referenced this issue Feb 22, 2022
lahma pushed a commit to lahma/NSwag that referenced this issue Dec 25, 2022
lahma pushed a commit to lahma/NSwag that referenced this issue Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants