Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/gnome-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@
}
},
"./misc/config/ambient": "./dist/misc/config-ambient.d.ts",
"./misc/dateUtils": {
"import": {
"types": "./dist/misc/dateUtils.d.ts",
"default": "./dist/misc/dateUtils.js"
},
"require": {
"types": "./dist/misc/dateUtils.d.ts",
"default": "./dist/misc/dateUtils.cjs"
}
},
"./misc/dateUtils/ambient": "./dist/misc/dateUtils-ambient.d.ts",
"./misc/dbusUtils": {
"import": {
"types": "./dist/misc/dbusUtils.d.ts",
Expand Down
38 changes: 38 additions & 0 deletions packages/gnome-shell/src/misc/dateUtils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import GLib from '@girs/glib-2.0';

/**
* Formats a Date object according to a C sprintf-style string using
* the cached local timezone.
*
* @param date a Date object
* @param format a format String for the date
*
* @version 49
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/misc/dateUtils.js#L41
*/
export function formatDateWithCFormatString(date: Date, format: string): string;

/**
* Formats a time span string representing the
* date passed in to the current time.
*
* @param date the start of the time span
*
* @version 49
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/misc/dateUtils.js#L54
*/
export function formatTimeSpan(date: GLib.DateTime): string;

/**
* Formats a date time string based on style parameters
*
*
* @param time a Date object
* @param [params] style parameters for the output string
* @param params.timeOnly whether the string should only contain the time (no date)
* @param params.ampm whether to include the "am" or "pm" in the string
*
* @version 49
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/misc/dateUtils.js#L123
*/
export function formatTime(time: GLib.DateTime | Date, params?: { timeOnly?: boolean; ampm?: boolean }): string;