Fixed issue#478 - Token without expiration timestamp expires "01/01/1970”.

This commit is contained in:
Martin Edenhofer 2016-11-29 21:54:49 +01:00
parent e0b70cb24f
commit 53440fbbdd
2 changed files with 44 additions and 0 deletions

View file

@ -288,9 +288,11 @@ class _i18nSingleton extends Spine.Module
@_notTranslated[locale][key] = true
date: (time, offset) =>
return time if !time
@convert(time, offset, @mapTime['date'] || @dateFormat)
timestamp: (time, offset) =>
return time if !time
@convert(time, offset, @mapTime['timestamp'] || @timestampFormat)
convert: (time, offset, format) ->

View file

@ -312,6 +312,27 @@ test('i18n', function() {
var timestamp = App.i18n.translateTimestamp('2012-11-06T21:07:24Z', offset);
equal(timestamp, '06.11.2012 21:07', 'de-de - timestamp translated correctly')
timestamp = App.i18n.translateTimestamp('', offset);
equal(timestamp, '', 'de-de - timestamp translated correctly')
timestamp = App.i18n.translateTimestamp(null, offset);
equal(timestamp, null, 'de-de - timestamp translated correctly')
timestamp = App.i18n.translateTimestamp(undefined, offset);
equal(timestamp, undefined, 'de-de - timestamp translated correctly')
var date = App.i18n.translateDate('2012-11-06', 0)
equal(date, '06.11.2012', 'de-de - date translated correctly')
date = App.i18n.translateDate('', 0)
equal(date, '', 'de-de - date translated correctly')
date = App.i18n.translateDate(null, 0)
equal(date, null, 'de-de - date translated correctly')
date = App.i18n.translateDate(undefined, 0)
equal(date, undefined, 'de-de - date translated correctly')
// en
App.i18n.set('en-us')
translated = App.i18n.translateContent('yes')
@ -368,6 +389,27 @@ test('i18n', function() {
timestamp = App.i18n.translateTimestamp('2012-11-06T21:07:24Z', offset)
equal(timestamp, '11/06/2012 21:07', 'en - timestamp translated correctly')
timestamp = App.i18n.translateTimestamp('', offset);
equal(timestamp, '', 'en - timestamp translated correctly')
timestamp = App.i18n.translateTimestamp(null, offset);
equal(timestamp, null, 'en - timestamp translated correctly')
timestamp = App.i18n.translateTimestamp(undefined, offset);
equal(timestamp, undefined, 'en - timestamp translated correctly')
date = App.i18n.translateDate('2012-11-06', 0)
equal(date, '11/06/2012', 'en - date translated correctly')
date = App.i18n.translateDate('', 0)
equal(date, '', 'en - date translated correctly')
date = App.i18n.translateDate(null, 0)
equal(date, null, 'en - date translated correctly')
date = App.i18n.translateDate(undefined, 0)
equal(date, undefined, 'en - date translated correctly')
// locale alias test
// de
App.i18n.set('de')