Skip to content

fixing datetime tostring locale issue #150

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

Merged
merged 5 commits into from
Sep 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private bool IsDiscoveryNeeded(string vmName, string rgName, out CSMContainerRes
else
{
//We can have multiple container with same friendly name.
container = containers.Where(c => ContainerHelpers.GetRGNameFromId(c.Properties.ParentContainerId).Equals(rgName.ToLower())).FirstOrDefault(); //TODO need to change.
container = containers.Where(c => ContainerHelpers.GetRGNameFromId(c.Properties.ParentContainerId).Equals(rgName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (container == null)
{
//Container is not in list of registered container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using System;
using System.Globalization;
using System.Management.Automation;
using System.Collections.Generic;
using System.Xml;
Expand Down Expand Up @@ -132,17 +133,19 @@ protected override void ProcessRecord()
To = DateTime.UtcNow;
}

WriteDebug(String.Format(Resources.StartTimeFilter, System.Uri.EscapeDataString(From.Value.ToString("yyyy-MM-dd hh:mm:ss tt"))));
WriteDebug(String.Format(Resources.EndTimeFilter, System.Uri.EscapeDataString(To.Value.ToString("yyyy-MM-dd hh:mm:ss tt"))));
DateTimeFormatInfo format = new CultureInfo("en-US").DateTimeFormat;
WriteDebug(String.Format(Resources.StartTimeFilter, System.Uri.EscapeDataString(From.Value.ToString("yyyy-MM-dd hh:mm:ss tt", format))));
WriteDebug(String.Format(Resources.EndTimeFilter, System.Uri.EscapeDataString(To.Value.ToString("yyyy-MM-dd hh:mm:ss tt", format))));
WriteDebug(String.Format(Resources.OperationFilter, Operation));
WriteDebug(String.Format(Resources.StatusFilter, Status));
WriteDebug(String.Format(Resources.TypeFilter, Type));
WriteDebug(String.Format(Resources.JobIdFilter, JobId));

Mgmt.CSMJobQueryObject queryParams = new Mgmt.CSMJobQueryObject()
{
StartTime = From.Value.ToString("yyyy-MM-dd hh:mm:ss tt"),
EndTime = To.Value.ToString("yyyy-MM-dd hh:mm:ss tt"),

StartTime = From.Value.ToString("yyyy-MM-dd hh:mm:ss tt", format),
EndTime = To.Value.ToString("yyyy-MM-dd hh:mm:ss tt", format),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the REST API expects the times to be in this en-US format, which implies that the portal code has something similar?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Portal also converts the object into string of this format. But we don't use format there because we don't use other locales.

Operation = Operation,
Status = Status,
WorkloadType = Type,
Expand Down