Last active
January 3, 2016 02:39
-
-
Save nikcorg/8397023 to your computer and use it in GitHub Desktop.
Localised Moment.js
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
{ | |
"name": "moment-demo", | |
"version": "0.0.0", | |
"authors": [ | |
"Niklas Lindgren <[email protected]>" | |
], | |
"description": "localisation inclusion demo", | |
"dependencies": { | |
"moment": "~2.5.0", | |
"requirejs": "~2.1.10" | |
} | |
} |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Moment localised</title> | |
<script src="bower_components/requirejs/require.js"></script> | |
<script> | |
require.config({ | |
paths: { | |
"moment": "bower_components/moment/moment", | |
"moment-langs": "bower_components/moment/lang" | |
} | |
}); | |
</script> | |
<script> | |
define("moment-fi", ["moment", "moment-langs/fi"], function (moment, fi) { | |
return moment; | |
}); | |
require(["moment-fi"], function (moment) { | |
console.log( moment(Date.now()).calendar() ); | |
}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment