Created
January 30, 2014 14:13
-
-
Save Torthu/8709215 to your computer and use it in GitHub Desktop.
Very naive class for getting localised "short dates" on the form "30. jan" when you cannot trust locale.
This file contains hidden or 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
| DateUtil = { | |
| getShortDate: -> | |
| date = new Date() | |
| return date.getDate() + '. ' + @_monthName(date.getMonth()).substring(0,3).toLowerCase() | |
| _monthName: (monthId) -> | |
| @months = { | |
| 0: 'Januar' | |
| 1: 'Februar' | |
| 2: 'Mars' | |
| 3: 'April' | |
| 4: 'Mai' | |
| 5: 'Juni' | |
| 6: 'Juli' | |
| 7: 'August' | |
| 8: 'September' | |
| 9: 'Oktober' | |
| 10: 'November' | |
| 11: 'Desember' | |
| } | |
| if @months[monthId] | |
| return @months[monthId] | |
| else | |
| return '' | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment