superdesk/superdesk-client-core

View on GitHub
scripts/api/time.ts

Summary

Maintainability
A
0 mins
Test Coverage
import {getTimezoneLabels} from 'apps/dashboard/world-clock/timezones-all-labels';
import {OrderedMap} from 'immutable';

/**
 * Returns translated labels of time zones indexed by time zone IDs
 */
function getTimeZones(): OrderedMap<string, string> {
    let result = OrderedMap<string, string>();

    for (const [id, label] of Object.entries(getTimezoneLabels())) {
        result = result.set(id, label);
    }

    return result;
}

export const time = {
    getTimeZones,
};