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

Updating type script date format #124

Closed

Conversation

jacob-kinzer
Copy link

@jacob-kinzer jacob-kinzer commented Feb 19, 2019

Updating typescript for the graphs to pass back the date in the correct formatting using iso8601 which should guarantee an 2 digit format for month and day.

In reference to #117

Sidenote: I am by no means an expert in JS/TS so any feedback is welcome.

Aha! Link: https://t-mobile1t-mobile.aha.io/features/PM-390

sajeer-nooh and others added 30 commits January 31, 2019 13:36
…nstaller has been made. Destroy tasks before tf destroy is removed as it would prolong time of destroy
Exit destroy if batch jobs are running
New PacBot Install/Destroy Script
This is a part of new installer release
Updated cloudwatch rule execution schedule
The first slide - Q1 plan
THe second slide - all 4 quarters. Q2-Q4 are subject to change.
…python communicate method and polling is done to check process running. Batch job checking returns warning message instead of returning exception
@adiagrwl94 adiagrwl94 closed this Feb 21, 2019
Copy link
Contributor

@adiagrwl94 adiagrwl94 left a comment

Choose a reason for hiding this comment

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

Reopening as this is in master.

@adiagrwl94 adiagrwl94 reopened this Feb 21, 2019
Copy link
Contributor

@adiagrwl94 adiagrwl94 left a comment

Choose a reason for hiding this comment

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

The date in ISOString is of YYYYMMDD format and instead of making date by getMonth() + 1, this would take care of the date format as well as timezone differences to UTC. Approving the PR. @jacob-kinzer Thank you for your contribution! We can close issue 117 with this.

@adiagrwl94
Copy link
Contributor

@jacob-kinzer Feedback: The javascript prevDate.setMonth(prevDate.getMonth() - 1); will take care even if month is January. You wouldn't need to explicitly handle it by setting one month back as December and of previous year. This is handled by the setMonth itself!

@jacob-kinzer
Copy link
Author

@jacob-kinzer Feedback: The javascript prevDate.setMonth(prevDate.getMonth() - 1); will take care even if month is January. You wouldn't need to explicitly handle it by setting one month back as December and of previous year. This is handled by the setMonth itself!

Sorry do you mean like

? During my testing it seemed like the backend API was expecting the date to be a month back, otherwise if i did not set it a month back the graphs were only show today - today, if that makes sense. Let me know if i misunderstood what you were referencing though.

@adiagrwl94
Copy link
Contributor

@jacob-kinzer What I mean to say is in:

if (today.getMonth() === 0) { // No need to handle this
today.setFullYear(today.getFullYear() - 1); // not required
today.setMonth(11); // not required
fromDay = today.toISOString().substring(0, 10);
}

The else { today.setMonth(today.getMonth() - 1); fromDay = today.toISOString().substring(0, 10); } will take care of getMonth() == 0 (January) too. The JS takes January minus one month as December of Previous year in setDate()!

Copy link
Contributor

@adiagrwl94 adiagrwl94 left a comment

Choose a reason for hiding this comment

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

@jacob-kinzer It would be great if you could contribute further to this!

@jacob-kinzer
Copy link
Author

Sorry i wasnt able to get back to you faster work has been busy. I am not sure if this PR is needed anymore. It looks like there is a commit in the 1.2 branch that should handle this use case:

3ca755c

If this PR is still needed i can update it otherwise i think it can be closed.

@adiagrwl94
Copy link
Contributor

@jacob-kinzer We would still be looking forward for this PR and requested change to be made as this is to master branch. Please do remove the redundant separate handling of getMonth() === 0 as this is not required as an if-else loop. Thanks.

Example:
const dateToday = new Date('2019-01-03'); // January
let earlierDate = new Date(dateToday)
earlierDate.setMonth(dateToday.getMonth() - 1); // One month before January
earlierDate = earlierDate.toISOString().substring(0, 10);
console.log(earlierDate); // December of previous year (2018-12-03)

@CLAassistant
Copy link

CLAassistant commented Jul 31, 2019

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 7 committers have signed the CLA.

✅ kaykumar
✅ johnakash
✅ sajeer-nooh
❌ root
❌ codingalyona
❌ jacob-kinzer
❌ sukesh-ss


root seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codingalyona codingalyona added this to the Parking Lot milestone Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants