mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-25 01:40:10 +00:00
Support additional date formats.
Support "Now" in addition to "Present" along with year-only dates of the form "YYYY".
This commit is contained in:
parent
f03d2a05e7
commit
7bf25469de
@ -103,13 +103,16 @@ Abstract character/resume sheet representation.
|
||||
*/
|
||||
function _fmt( dt ) {
|
||||
dt = dt.toLowerCase().trim();
|
||||
if( dt === 'present' ) {
|
||||
if( /\s*(present|now)\s*/i.test(dt) ) { // "Present", "Now"
|
||||
return moment();
|
||||
}
|
||||
else if( /^\D+/.test(dt) ) {
|
||||
else if( /^\D+/.test(dt) ) { // "Mar 2015"
|
||||
var parts = dt.split(' ');
|
||||
return moment( parts[1] + '-' + (months[ parts[0] ] || abbr[ parts[0] ] || ( parts[0] === 'sept' && '09' )) + '-' + '01', 'YYYY-MM-DD' );
|
||||
}
|
||||
else if( /^\d+$/.test(dt) ) { // "2015"
|
||||
return moment( dt, 'YYYY' );
|
||||
}
|
||||
else {
|
||||
var mt = moment( dt );
|
||||
if(mt.isValid())
|
||||
|
Loading…
Reference in New Issue
Block a user