question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I include a modified datetime in the response via a JSON definition?

See original GitHub issue

I’m trying to add an hour to the current DateTime and include that new DateTime in the response.

I know I can get the current DateTime via {{DateTime.Now}}

But I can’t see how I can manipulate this.

I wondered about using Handlebars and splitting the string, then using an each and if’s to manipulate it, but I can’t seem to nest the response value of {{DateTime.Now}} into a handlebars expression.

Is nesting {{}} within each other across handlers not supported I take it, i.e. the inner customer handler for {{DateTime}} isn’t completed and substituted before the result is passed to handlebars for the {{each}} to be processed by that library.

EDIT: I originally misunderstood what Humanizer DateTime did and initially thought it could help with adding an hour to the time. hence the title and content change.

Issue Analytics

  • State:closed
  • Created 7 months ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
MichaelIDScommented, Apr 3, 2023

I know it’s very late, but yes. the date modification works nicely, thanks. šŸ‘

0reactions
StefHcommented, Mar 9, 2023

@MichaelIDS No problem, I’ll just merge the changes to master, and in the next days I’ll create a new NuGet.

I’ll close this issue and if you have another question, just raise a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the "right" JSON date format? - javascript
There is no right format ; The JSON specification does not specify a format for exchanging dates which is why there are so...
Read more >
The Definitive Guide to DateTime Manipulation
Here we will explore some of the key concepts that are necessary for manipulating date and time values correctly, formats that are convenient...
Read more >
JSON date format: 3 ways to work with dates in JSON
The article The optimal way to include dates in JSON for example concludes after benchmarking that serializing as timestamp is faster thanĀ ...
Read more >
Formatting JSON Dates in Spring Boot
In this tutorial, we'll show how to format JSON date fields in a Spring Boot application. We'll explore various ways of formatting datesĀ ......
Read more >
Validation: Improving date-time: min/max, linking & step #99
I can see a situation where a system puts a min date of todays date when the json-schema document is generated (on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found