-
Notifications
You must be signed in to change notification settings - Fork 526
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
MomentJS not returning correctly formatted date #196
Comments
Thanks for the report. Investigating... |
I believe this is resolved in latest (v1.9.0-beta). If not, let me know-- the version with that bug is a couple years old. |
I have the same problem with
Context:I'm using
Extract of ...
"education": {
"level": "",
"history": [
{
"institution": "Some institution",
"end": "2017-02-12",
"curriculum": [
"Some curriculum"
],
"summary": "",
"area": "Some area",
"studyType": "Certification"
}
]
},
... In the Word 2003 XML template file
ProblemWhen running AnalysisI had a quick look in the HackMyResume code, more specifically in
I understand from this description that 'dtFormat' is meant to be the output format defining how a given date should be formatted in the generated resume.
as documented in https://momentjs.com/docs/#/parsing/string-format/:
My conclusion and workaroundAs the date format used in the resume JSON file ("YYYY-MM-DD") may be different than the desired format in the output resume (here: "MMM YYYY"), I believe the 'dtFormat' parameter should not be passed to the 'moment' constructor. To test this, I replaced 'dtFormat' with a hard-coded "YYYY-MM-DD" (format used in the JSON resume) on line 70. This workaround seems to work as expected. Now the date output is 'Feb 2017'. ...
if (String.is(datetime)) {
// If a string was passed in, convert to Moment using the 2-paramter
// constructor with an explicit format string.
momentDate = moment(datetime, "YYYY-MM-DD" /*dtFormat*/);
if (momentDate.isValid()) {
return momentDate.format(dtFormat);
}
... BTW, I noted a similar issue in the 'date' generic helper function, defined at line 97, and 'moment' constructor at line 116. Worked around it with dateValueMoment = moment(dateValue,"YYYY-MM-DD" /* dateFormat*/); |
Thanks for the awesome writeup. Date handling code needs to be rewritten for v2.0 until then I think your solution is workable. We're not "agnostic" enough in the handling where we need to be and we're not specific enough when we can be. |
When modifying the awesome theme. The following line should return May 2015:
For every possible month (even full dates "2015-05-10") it always returns Jan XXX where XXX is the correct year passed to Moment. Is there something I'm missing? Looking at the coffeescript I couldn't find anywhere obvious that a mistake was made.
The text was updated successfully, but these errors were encountered: