summaryrefslogtreecommitdiff
path: root/doc/elementary/datetime.rst
blob: c2713964dec7e6b7252c7af85db8ebc24fef5c88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
.. currentmodule:: efl.elementary

Datetime
########

Widget description
==================

Datetime widget is used to display and input date & time values.

This widget displays date and time as per the **system's locale** settings
(Date includes Day, Month & Year along with the defined separators and Time
includes Hour, Minute & AM/PM fields). Separator for AM/PM field is ignored.

The corresponding Month, AM/PM strings are displayed according to the
system’s language settings.

Datetime format is a combination of LIBC standard characters like "%%d %%b
%%Y %%I : %%M  %%p" which, as a whole represents both Date as well as Time
format.

Elm_datetime supports only the following sub set of libc date format specifiers:

**%%Y** The year as a decimal number including the century (example: 2011).

**%%y** The year as a decimal number without a century (range 00 to 99)

**%%m** The month as a decimal number (range 01 to 12).

**%%b** The abbreviated month name according to the current locale.

**%%B** The full month name according to the current locale.

**%%h** The abbreviated month name according to the current locale(same as %%b).

**%%d** The day of the month as a decimal number (range 01 to 31).

**%%e** The day of the month as a decimal number (range 1 to 31). single
        digits are preceded by a blank.

**%%I** The hour as a decimal number using a 12-hour clock (range 01 to 12).

**%%H** The hour as a decimal number using a 24-hour clock (range 00 to 23).

**%%k** The hour (24-hour clock) as a decimal number (range 0 to 23). single
        digits are preceded by a blank.

**%%l** The hour (12-hour clock) as a decimal number (range 1 to 12); single
        digits are preceded by a blank.

**%%M** The minute as a decimal number (range 00 to 59).

**%%p** Either 'AM' or 'PM' according to the given time value, or the
        corresponding strings for the current locale. Noon is treated as 'PM'
        and midnight as 'AM'

**%%P** Like %p but in lower case: 'am' or 'pm' or a corresponding string for
        the current locale.

**%%c** The preferred date and time representation for the current locale.

**%%x** The preferred date representation for the current locale without the time.

**%%X** The preferred time representation for the current locale without the date.

**%%r** The complete calendar time using the AM/PM format of the current locale.

**%%R** The hour and minute in decimal numbers using the format %H:%M.

**%%T** The time of day in decimal numbers using the format %H:%M:%S.

**%%D** The date using the format %%m/%%d/%%y.

**%%F** The date using the format %%Y-%%m-%%d.


(For more reference on the available **LIBC date format specifiers**,
please visit the link:
http://www.gnu.org/s/hello/manual/libc.html#Formatting-Calendar-Time )

Datetime widget can provide Unicode **separators** in between its fields
except for AM/PM field. A separator can be any **Unicode character**
other than the LIBC standard date format specifiers.

Example: In the format::

    %%b %%d **,** %%y %%H **:** %%M

comma(,) is separator for date field %%d and colon(:) is separator for
hour field %%H.

The default format is a predefined one, based on the system Locale.

Hour format 12hr(1-12) or 24hr(0-23) display can be selected by setting
the corresponding user format.

Datetime supports six fields: Year, Month, Date, Hour, Minute, AM/PM.
Depending on the Datetime module that is loaded, the user can see
different UI to select the individual field values.

The individual fields of Datetime can be arranged in any order according
to the format set by application.

There is a provision to set the visibility of a particular field as TRUE/
FALSE so that **only time/ only date / only required fields** will be
displayed.

Each field is having a default minimum and maximum values just like the
daily calendar information. These min/max values can be modified as per
the application usage.

User can enter the values only in between the range of maximum and
minimum. Apart from these APIs, there is a provision to display only a
limited set of values out of the possible values. APIs to select the
individual field limits are intended for this purpose.

The whole widget is left aligned and its size grows horizontally
depending on the current format and each field's visible/disabled state.

Datetime individual field selection is implemented in a modular style.
Module can be implemented as a Ctxpopup based selection or an ISE based
selection or even a spinner like selection etc.

Datetime Module design
======================

The following functions are expected to be implemented in a Datetime module:

**Field creation**::

     __________                                            __________
    |          |----- obj_hook() ---------------------->>>|          |
    |          |<<<----------------returns Mod_data ------|          |
    | Datetime |_______                                   |          |
    |  widget  |       |Assign module call backs          |  Module  |
    |   base   |<<<____|                                  |          |
    |          |                                          |          |
    |          |----- field_create() ------------------>>>|          |
    |__________|<<<----------------returns field_obj -----|__________|

**Field value setting**::

     __________                                          __________
    |          |                                        |          |
    | Datetime |<<<----------elm_datetime_value_set()---|          |
    |  widget  |                                        |  Module  |
    |   base   |----display_field_value()------------>>>|          |
    |__________|                                        |__________|

**del_hook**::

     __________                                          __________
    |          |                                        |          |
    | Datetime |----obj_unhook()-------------------->>>>|          |
    |  widget  |                                        |  Module  |
    |   base   |         <<<-----frees mod_data---------|          |
    |__________|                                        |__________|

Any module can use the following shared functions that are implemented in
elm_datetime.c:

**field_format_get()** - gives the field format.

**field_limit_get()**  - gives the field minimum, maximum limits.

To enable a module, set the ELM_MODULES environment variable as shown:

**export ELM_MODULES="datetime_input_ctxpopup>datetime/api"**


Emitted signals
===============

- ``changed`` - whenever Datetime field value is changed, this signal is sent.
- ``language,changed`` - whenever system locale changes, this signal is sent.
- ``focused`` - When the datetime has received focus. (since 1.8)
- ``unfocused`` - When the datetime has lost focus. (since 1.8)


Enumerations
============

.. _Elm_Datetime_Field_Type:

Datetime fields
---------------

.. data:: ELM_DATETIME_YEAR

    Year

.. data:: ELM_DATETIME_MONTH

    Month

.. data:: ELM_DATETIME_DATE

    Date

.. data:: ELM_DATETIME_HOUR

    Hour

.. data:: ELM_DATETIME_MINUTE

    Minute

.. data:: ELM_DATETIME_AMPM

    Am/Pm


Inheritance diagram
===================

.. inheritance-diagram:: Datetime
    :parts: 2

.. autoclass:: Datetime