1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsISupports.idl"
40 typedef long nsDateFormatSelector
;
44 kDateFormatNone
= 0, // do not include the date in the format string
45 kDateFormatLong
, // provides the long date format for the given locale
46 kDateFormatShort
, // provides the short date format for the given locale
47 kDateFormatYearMonth
, // formats using only the year and month
48 kDateFormatWeekday
// week day (e.g. Mon, Tue)
52 typedef long nsTimeFormatSelector
;
56 kTimeFormatNone
= 0, // don't include the time in the format string
57 kTimeFormatSeconds
, // provides the time format with seconds in the given locale
58 kTimeFormatNoSeconds
, // provides the time format without seconds in the given locale
59 kTimeFormatSecondsForce24Hour
, // forces the time format to use the 24 clock, regardless of the locale conventions
60 kTimeFormatNoSecondsForce24Hour
// forces the time format to use the 24 clock, regardless of the locale conventions
65 // Define Contractid and CID
66 // {2EA2E7D0-4095-11d3-9144-006008A6EDF6}
67 #define NS_SCRIPTABLEDATEFORMAT_CID \
68 { 0x2ea2e7d0, 0x4095, 0x11d3, { 0x91, 0x44, 0x0, 0x60, 0x8, 0xa6, 0xed, 0xf6 } }
70 #define NS_SCRIPTABLEDATEFORMAT_CONTRACTID
"@mozilla.org/intl/scriptabledateformat;1"
73 NS_NewScriptableDateFormat
(nsISupports
* aOuter
, REFNSIID aIID
, void** aResult
);
76 [scriptable
, uuid(0c89efb0
-1aae
-11d3
-9141-006008a6edf6
)]
77 interface nsIScriptableDateFormat
: nsISupports
{
79 const long dateFormatNone
= 0; // do not include the date in the format string
80 const long dateFormatLong
=1; // provides the long date format for the given locale
81 const long dateFormatShort
=2; // provides the short date format for the given locale
82 const long dateFormatYearMonth
=3; // formats using only the year and month
83 const long dateFormatWeekday
= 4; // week day (e.g. Mon, Tue)
86 // The original definitions of dateFormatLong and dateFormatShort are from windows platform.
87 // dateFormatLong output will be like: Wednesday, January 29, 2003 4:02:14 PM
88 // dateFormatShort output will be like: 1/29/03 4:02:14 PM
89 // On platforms like Linux and OS2, it is rather difficult to achieve exact same output, and since we are aiming
90 // at human readers, it does not make sense to achieve exact same result. We should do just enough as the platform
91 // allow us to do, unless there is other strong reasons for other approaches.
93 const long timeFormatNone
= 0; // don't include the time in the format string
94 const long timeFormatSeconds
= 1; // provides the time format with seconds in the given locale
95 const long timeFormatNoSeconds
= 2; // provides the time format without seconds in the given locale
96 const long timeFormatSecondsForce24Hour
= 3; // forces the time format to use the 24 clock, regardless of the locale conventions
97 const long timeFormatNoSecondsForce24Hour
= 4; // forces the time format to use the 24 clock, regardless of the locale conventions
99 // format date and time, locale is language country pair (e.g. en-US) or empty string for application default
100 wstring FormatDateTime
(in wstring locale
,
101 in long dateFormatSelector
,
102 in long timeFormatSelector
,
109 // format date, locale is language country pair (e.g. en-US) or empty string for application default
110 wstring FormatDate
(in wstring locale
,
111 in long dateFormatSelector
,
115 // format time, locale is language country pair (e.g. en-US) or empty string for application default
116 wstring FormatTime
(in wstring locale
,
117 in long timeFormatSelector
,