-
Notifications
You must be signed in to change notification settings - Fork 407
Formatting for VS Code change #3748
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
Changes from 3 commits
d252c34
5b2215c
33f5156
e209e8c
b6b0d2c
3a64474
a839ac4
bda3eca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
using System.Text.RegularExpressions; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
using Microsoft.DotNet.Interactive.Parsing; | ||
|
||
namespace Microsoft.DotNet.Interactive.Http.Parsing | ||
|
@@ -183,6 +184,13 @@ private static DateTimeOffset DefaultGetDateTimeOffset(bool isLocal) | |
else if (string.Equals(type.Value, "iso8601", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
format = "o"; | ||
if (currentDateTimeOffset.Offset.TotalMinutes == 0) | ||
{ | ||
// for $datetime, format the DateTime in order to eliminate the +00:00 offset and use Z | ||
string text = currentDateTimeOffset.UtcDateTime.ToString(format, formatProvider); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a try catch around the ToString below, should there be one here too? |
||
|
||
return node.CreateBindingSuccess(text); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a huge deal but could we do something to consolidate the return statements for the success cases? There are many returns in this block and it makes the code a little difficult to read... For example, consider changing it to something like below where each block computes a value for
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may also make sense to extract a separate function for the try block above if you refactor the code to look like above... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's set up a little time for a group coding session. |
||
} | ||
} | ||
else | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have unit tests that cover each of the formatting cases covered in this function?