@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
40 lines (38 loc) • 1.61 kB
TypeScript
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import GlobalState from '../models/GlobalState';
export interface TimezoneDescriptor {
name: string;
offset: string;
}
export declare const getTimezones: () => TimezoneDescriptor[];
export declare function asDayMonthDateTime(date: string): string;
export declare function asLocalizedDateTime(
date: string | number | Date,
localeCode: string,
dateTimeFormatOptions?: GlobalState['uiConfig']['locale']['dateTimeFormatOptions']
): string;
export declare function getUserTimeZone(): string;
export declare function getUserLocaleCode(): string;
/**
* Create ISO 8601 string
**/
export declare const create8601String: (date: string, time: string, offset: string) => string;
/**
* Returns an array as ['yyyy-mm-dd', 'hh:mm:ss', '+/-nn:nn'] out of a ISO 8601 date string
**/
export declare const get8601Pieces: (date: string | Date) => string[];
export declare function isSameDay(date1: Date, date2: Date): boolean;