mirror of https://github.com/nextcloud/calendar
Fix timezone names
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
827a71b950
commit
c37f76282b
|
@ -32,7 +32,8 @@ export function getSortedTimezoneList(timezoneList = [], additionalTimezones = [
|
|||
const sortedList = []
|
||||
|
||||
for (const timezoneId of timezoneList) {
|
||||
let [continent, name] = timezoneId.split('/', 2)
|
||||
const components = timezoneId.split('/')
|
||||
let [continent, name] = [components.shift(), components.join('/')]
|
||||
if (!name) {
|
||||
name = continent
|
||||
// TRANSLATORS This refers to global timezones in the timezone picker
|
||||
|
|
|
@ -115,9 +115,10 @@ describe('utils/timezone test suite', () => {
|
|||
expect(translate).toHaveBeenNthCalledWith(3, 'calendar', 'Global')
|
||||
})
|
||||
|
||||
it ('should get a readable timezone name', () => {
|
||||
it('should get a readable timezone name', () => {
|
||||
expect(getReadableTimezoneName('Europe/Berlin')).toEqual('Europe - Berlin')
|
||||
expect(getReadableTimezoneName('America/New_York')).toEqual('America - New York')
|
||||
expect(getReadableTimezoneName('America/St_Johns')).toEqual('America - St. Johns')
|
||||
expect(getReadableTimezoneName('America/Argentina/Buenos_Aires')).toEqual('America - Argentina - Buenos Aires')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue