Last active
July 27, 2016 10:56
-
-
Save shrutis22/fba18ab76bdf522736fca33d7d9f464f to your computer and use it in GitHub Desktop.
Convert a date to system locale date.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formatDate = function() { | |
moment.locale( window.navigator.userLanguage || window.navigator.language ); | |
$( "[data-type='date']" ).each( | |
function() { | |
var currentDate = $( this ).html(); | |
if( currentDate !== '' ) { | |
var formatedDate = moment( currentDate ).format( 'L' ); | |
$( this ).html( formatedDate ); | |
} | |
} | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment