Class RelativeDate
- All Implemented Interfaces:
HasHandlers
RelativeDateItem
class.
The value attribute is set to a string which specifies the offset from some base date (typically
the current date as returned from a call to new Date();
).
See RelativeDate(String)
for details on the expected format of the string passed in.
-
Field Summary
Modifier and TypeFieldDescriptionstatic RelativeDate
Builtin option for the end of the current monthstatic RelativeDate
Builtin option for the end of today (one millisecond before theSTART_OF_TODAY
static RelativeDate
Builtin option for the end of tomorrow (one millisecond before theSTART_OF_TOMORROW
)static RelativeDate
Builtin option for the end of the current weekstatic RelativeDate
Builtin option for the end of the current yearstatic RelativeDate
Builtin option for the end of yesterday (one millisecond before theSTART_OF_YESTERDAY
)static RelativeDate
Builtin option for the current day of the previous monthstatic RelativeDate
Builtin option for the current day of the following monthstatic RelativeDate
Builtin option for this moment - equivalent to callingnew RelativeDate(RelativeDateShortcut.NOW);
static RelativeDate
Builtin option for this momentstatic RelativeDate
Builtin option for the start of today (same asTODAY
)static RelativeDate
Builtin option for the start of tomorrow (same asTOMORROW
)static RelativeDate
Builtin option for the start of the current weekstatic RelativeDate
Builtin option for the start of the current yearstatic RelativeDate
Builtin option for the start of yesterday (same asYESTERDAY
)static RelativeDate
Builtin option for the start of todaystatic RelativeDate
Builtin option for the start of tomorrowstatic RelativeDate
Builtin option for the current day of the previous weekstatic RelativeDate
Builtin option for the current day of the following weekstatic RelativeDate
Builtin option for the start of yesterdayFields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties
-
Constructor Summary
ConstructorDescriptionRelativeDate
(JavaScriptObject jsObj) RelativeDate
(RelativeDateRangePosition rangePosition, String value) RelativeDate
(String value) The value attribute of a RelativeDate object is a string that should be specified in one of 2 formats: -
Method Summary
Methods inherited from class com.smartgwt.client.core.DataClass
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
-
Field Details
-
NOW
Builtin option for this moment - equivalent to callingnew RelativeDate(RelativeDateShortcut.NOW);
-
TODAY
Builtin option for the start of today -
START_OF_TODAY
Builtin option for the start of today (same asTODAY
) -
END_OF_TODAY
Builtin option for the end of today (one millisecond before theSTART_OF_TODAY
-
YESTERDAY
Builtin option for the start of yesterday -
START_OF_YESTERDAY
Builtin option for the start of yesterday (same asYESTERDAY
) -
END_OF_YESTERDAY
Builtin option for the end of yesterday (one millisecond before theSTART_OF_YESTERDAY
) -
TOMORROW
Builtin option for the start of tomorrow -
START_OF_TOMORROW
Builtin option for the start of tomorrow (same asTOMORROW
) -
END_OF_TOMORROW
Builtin option for the end of tomorrow (one millisecond before theSTART_OF_TOMORROW
) -
WEEK_AGO
Builtin option for the current day of the previous week -
WEEK_FROM_NOW
Builtin option for the current day of the following week -
MONTH_AGO
Builtin option for the current day of the previous month -
MONTH_FROM_NOW
Builtin option for the current day of the following month -
START_OF_WEEK
Builtin option for the start of the current week -
END_OF_WEEK
Builtin option for the end of the current week -
START_OF_MONTH
Builtin option for this moment -
END_OF_MONTH
Builtin option for the end of the current month -
START_OF_YEAR
Builtin option for the start of the current year -
END_OF_YEAR
Builtin option for the end of the current year
-
-
Constructor Details
-
RelativeDate
The value attribute of a RelativeDate object is a string that should be specified in one of 2 formats:There are a number of standard preset shortcut date-offset strings. These include the following
- $now - this moment
- $today - the current day. By default this resolves to the start of the current day though an explicit +link{RelativeDateRangePosition} may be used to specify the end of the current day.
- $startOfToday - the start of today
- $endOfToday - the end of today (one millisecond before the $startOfTomorrow)
- $yesterday - the previous day.
- $startOfYesterday - the start of yesterday
- $endOfYesterday - the end of yesterday (one millisecond before the $startOfToday)
- $tomorrow - the following day
- $startOfTomorrow - the start of tomorrow
- $endOfTomorrow - the end of tomorrow
- $startOfWeek - the start of the current week
- $endOfWeek - the end of the current week
- $startOfMonth - the start of the current month
- $endOfMonth - the end of the current month
- $startOfYear - the start of the current year
- $endOfYear - the end of the current year
Alternatively the value can be a special RelativeDateString comprised of the following parts:
- direction: the direction in which the quantity applies - one of + or -
- quantity: the number of units of time to apply - a number
- timeUnit: an abbreviated timeUnit to use - one of ms/MS (millisecond), s/S (second),
mn/MN (minute), h/H (hour), d/D (day), w/W (week), m/M (month), q/Q (quarter, 3-months),
y/Y (year), dc/DC (decade) or c/C (century).
The timeUnit is case sensitive. A lowercase timeUnit implies an exact offset, so+1d
refers to the current date / time increased by exactly 24 hours. If the timeUnit is uppercase, it refers to the start or end boundary of the period of time in question, so+1D
would refer to the end of the day (23:39:59:999) tomorrow, and-1D
would refer to the start of the day (00:00:00:000) yesterday. - [qualifier]: an optional timeUnit encapsulated in square-brackets and used to offset the calculation - eg. if +1d is "plus one day", +1d[W] is "plus one day from the end of the current week". You may also specify another complete RelativeDateString as the [qualifier], which offers more control - eg, +1d[+1W] indicates "plus one day from the end of NEXT week".
This format is very flexible. Here are a few example relative date strings:
+0D
: End of today. There are often multiple ways to represent the same time using this system - for example this could also be written as-1ms[+1D]
-0D
: Beginning of today.
+1W
: End of next week.
+1ms[+0W]
: Beginning of next week.
+1w[-0D]
: Beginning of the current day of next week.- Parameters:
value
- string representation of the relative date
-
RelativeDate
-
RelativeDate
-
-
Method Details
-
getRangePosition
-
getValue
- Returns:
- the string representation of the relative date
- See Also:
-
getJsObj
-