components_node/functions-generic.js
/**
     * Return date with a specific time zone.
     * @static
     * @param {string} timezoneLocal 
     * @param {string} configDateFormat 1 - portuguese dd/mm/yyyy | 2 - britanic mm/dd/yyyy
     * @returns {Date} 
     * @example
     * SyncSystemNS.FunctionsGeneric.timeZoneConverter()
     */
Return date with a specific time zone.
Return date with a specific time zone .
static timeZoneConverter(timezoneLocal = "", configDateFormat = "")
    {
        let strReturn = new Date();
        let timezoneLocale = "en-US";
        if(configDateFormat == "1")
        {
            timezoneLocale = "pt-BR";
        }
        if(configDateFormat == "2")
        {
            timezoneLocale = "en-GB";
        }
        strReturn = Date().toLocaleString(timezoneLocale, {
            timeZone: gSystemConfig.configSystemTimeZone
        });
        return new Date(strReturn);
    }
static timeZoneConverter ( timezoneLocal = "" , configDateFormat = "" ) { let strReturn = new Date ( ) ; let timezoneLocale = "en-US" ; if ( configDateFormat == "1" ) { timezoneLocale = "pt-BR" ; } if ( configDateFormat == "2" ) { timezoneLocale = "en-GB" ; } strReturn = Date ( ) . toLocaleString ( timezoneLocale , { timeZone : gSystemConfig . configSystemTimeZone } ) ; return new Date ( strReturn ) ; }
Return date with a specific time zone.
Return date with a specific time zone .
//Variables. //---------------------- //---------------------- //Variables values. //timezoneLocale = "en-US"; //Logic. //Debug. //return nDate; //const nDate = new Date().toLocaleString('en-US', { //timeZone: gSystemConfig.configSystemTimeZone //}); //Aditional information: /*
        const map = new Map([
        [-11, 'Pacific/Niue'],
        [-10, 'Pacific/Tahiti'],
        [-9, 'Pacific/Gambier'],
        [-8, 'Pacific/Pitcairn'],
        [-7, 'America/Vancouver'],
        [-6, 'America/Denver'],
        [-5, 'America/Rio_Branco'],
        [-4, 'America/Manaus'],
        [-3, 'America/Cayenne'],
        [-2, 'Atlantic/South_Georgia'],
        [-1, 'Atlantic/Azores'],
        [0, 'GMT'],
        [1, 'Europe/Brussels'],
        [2, 'Europe/Helsinki'],
        [3, 'Asia/Riyadh'],
        [4, 'Asia/Dubai'],
        [5, 'Asia/Tashkent'],
        [6, 'Asia/Urumqi'],
        [7, 'Asia/Bangkok'],
        [8, 'Asia/Singapore'],
        [9, 'Asia/Chita'],
        [10, 'Pacific/Chuuk'],
        [11, 'Pacific/Pohnpei'],
        [12, 'Pacific/Wake'],
        ])*/ //return strReturn;