| Package | com.keepcore.calendar.utils |
| Class | public class CalendarDateUtils |
| Inheritance | CalendarDateUtils Object |
| Property | Defined By | ||
|---|---|---|---|
| FIRST_DAY_OF_WEEK : int = 1 [static]
Defines the first day of week. | CalendarDateUtils | ||
| Method | Defined By | ||
|---|---|---|---|
compareDates(Date1:Date, Date2:Date, justDay:Boolean = false):int [static]
Compare 2 dates. | CalendarDateUtils | ||
convertTimeInSecondsToMinutesSecondsString(timeSeconds:Number):String [static]
Returns a time given in seconds in String with the following format "__:__"
| CalendarDateUtils | ||
convertTimeInSecondsToString(timeSeconds:Number, removeSeconds:Boolean = false):String [static]
Returns a time given in seconds in String with the following format "_h__mn__s" (more than 1h), "__mn__s" (more than 1mn) or "__s" (less than 1mn),
| CalendarDateUtils | ||
endOfWeek(date:Date):Date [static]
Returns the last day of the week. | CalendarDateUtils | ||
EuropeanStringToDate(aString:String):Date [static]
Creates a Date object and initializes it using the passed string. | CalendarDateUtils | ||
getCompleteDateTimeToString(date:Date):String [static]
Return complete date and time with seconds & milliseconds. | CalendarDateUtils | ||
getDateDayIndex(date:Date):int [static]
Return the day index of a date according to the FIRST_DAY_OF_WEEK variable. | CalendarDateUtils | ||
getDateFormatString():String [static]
Return date format string. | CalendarDateUtils | ||
getDateRangeToString(range:DateRange):String [static]
Return date range string. | CalendarDateUtils | ||
getDateToString(date:Date):String [static]
Return date string (without time). | CalendarDateUtils | ||
getDayHeaderDateToString(date:Date, format:int):String [static]
Return date day string (number by default). | CalendarDateUtils | ||
getDayHeaderDayToStringByDayNumber(day:int):String [static]
Return day date string (string by default). | CalendarDateUtils | ||
getDaysDifference(date1:Date, date2:Date):int [static]
Returns day count between 2 dates. | CalendarDateUtils | ||
getFirstDayOfYear(date:Date):Date [static] | CalendarDateUtils | ||
getFullDateAndTimeToEuropeanString(date:Date):String [static]
Return date formatted to european string ("D/MM/YYYY JJ:NN"). | CalendarDateUtils | ||
getFullDateAndTimeToString(date:Date):String [static]
Return full date & time string. | CalendarDateUtils | ||
getFullDayMonthYearToString(date:Date):String [static]
Return full day, month & year string. | CalendarDateUtils | ||
getFullDayToStringByDayNumber(day:int):String [static]
Return day to string. | CalendarDateUtils | ||
getFullYearToString(date:Date):String [static]
Return full year string. | CalendarDateUtils | ||
getHourToString(date:Date):String [static]
Retour hour to string. | CalendarDateUtils | ||
getLastDayOfMonth(date:Date):Date [static]
Return the last day of month. | CalendarDateUtils | ||
getLastDayOfMonthDate(date:Date):int [static]
Return the last day of month date. | CalendarDateUtils | ||
getMonthAndYearToString(date:Date):String [static]
Return date month & year to string. | CalendarDateUtils | ||
getMonthCellDayToString(date:Date):String [static]
Return date day to string. | CalendarDateUtils | ||
getNextMonthDate(date:Date):Date [static]
Return the next month date according to a given date. | CalendarDateUtils | ||
getNextSameDateInMonth(date:Date):Date [static]
Returns the next same day date in month
| CalendarDateUtils | ||
getWeekNumber(date:Date):int [static]
Get date week number. | CalendarDateUtils | ||
getYearMonthToString(date:Date):String [static]
Return date month to string. | CalendarDateUtils | ||
isDayAfter(date1:Date, date2:Date):Boolean [static]
Returns if date1 day is after date2 day in time. | CalendarDateUtils | ||
isDayBefore(date1:Date, date2:Date):Boolean [static]
Returns if date1 day is before date2 day in time. | CalendarDateUtils | ||
isoToDate(value:String):Date [static]
Return date corresponding to given ISO string date (i.e: 2009-09-22T15:00:00.000Z). | CalendarDateUtils | ||
isSameDate(date1:Date, date2:Date):Boolean [static]
Returns if 2 dates are the same (no reference comparison, only date & time). | CalendarDateUtils | ||
isSameDay(date1:Date, date2:Date, checkSpecial:Boolean = false):Boolean [static]
Returns if 2 dates have the same day (no hours/min/sec/ms comparison)
| CalendarDateUtils | ||
isSameMonth(date1:Date, date2:Date):Boolean [static]
Returns if 2 dates have the same month (no date/hours/min/sec/ms comparison, only year & month)
| CalendarDateUtils | ||
isSpecialFullDayDate(date:Date):Boolean [static]
Returns if a date is set to 0h00
| CalendarDateUtils | ||
isTommorow(date1:Date, date2:Date):Boolean [static]
Returns if date1 is date2 tomorrow. | CalendarDateUtils | ||
middleOfWeek(date:Date):Date [static]
Returns the middle day of the week (4th day in the week). | CalendarDateUtils | ||
parseTime(value:String, guessAMPM:Boolean = false):Date [static]
Parse a time string and convert it to a Date (date part is always 01/01/2000). | CalendarDateUtils | ||
removeSecondsAndMilliseconds(value:Date):void [static]
Sets seconds & milliseconds to 0 in a Date. | CalendarDateUtils | ||
resetFormatters():void [static]
Reset all formatters (called internally upon resourceChanged event) in order to apply locale formats. | CalendarDateUtils | ||
startOfWeek(date:Date):Date [static]
Returns the first day of the week. | CalendarDateUtils | ||
| Constant | Defined By | ||
|---|---|---|---|
| DAY_DATE_LONG_FORMAT : int = 2 [static] | CalendarDateUtils | ||
| DAY_DATE_MEDIUM_FORMAT : int = 1 [static] | CalendarDateUtils | ||
| DAY_DATE_SHORT_FORMAT : int = 0 [static] | CalendarDateUtils | ||
| FRIDAY : uint = 5 [static] | CalendarDateUtils | ||
| MONDAY : uint = 1 [static] | CalendarDateUtils | ||
| MS_BY_DAY : int = 8.64E7 [static] | CalendarDateUtils | ||
| MS_BY_HOUR : int = 3600000.0 [static] | CalendarDateUtils | ||
| MS_BY_MINUTES : int = 60000.0 [static] | CalendarDateUtils | ||
| SATURDAY : uint = 6 [static] | CalendarDateUtils | ||
| SUNDAY : uint = 0 [static] | CalendarDateUtils | ||
| THURSDAY : uint = 4 [static] | CalendarDateUtils | ||
| TUESDAY : uint = 2 [static] | CalendarDateUtils | ||
| WEDNESDAY : uint = 3 [static] | CalendarDateUtils | ||
| FIRST_DAY_OF_WEEK | property |
public static var FIRST_DAY_OF_WEEK:int = 1Defines the first day of week.
| compareDates | () | method |
public static function compareDates(Date1:Date, Date2:Date, justDay:Boolean = false):intCompare 2 dates.
Parameters
Date1:Date — first date
| |
Date2:Date — second date
| |
justDay:Boolean (default = false) — indicates if only date are compared (no time comparison)
|
int — |
| convertTimeInSecondsToMinutesSecondsString | () | method |
public static function convertTimeInSecondsToMinutesSecondsString(timeSeconds:Number):StringReturns a time given in seconds in String with the following format "__:__"
Parameters
timeSeconds:Number — time in seconds
|
String — formatted string
|
| convertTimeInSecondsToString | () | method |
public static function convertTimeInSecondsToString(timeSeconds:Number, removeSeconds:Boolean = false):StringReturns a time given in seconds in String with the following format "_h__mn__s" (more than 1h), "__mn__s" (more than 1mn) or "__s" (less than 1mn),
Parameters
timeSeconds:Number — time in seconds
| |
removeSeconds:Boolean (default = false) — indicates if seconds have to be removed "_h__mn", "__mn" or nothing
|
String — formatted string
|
| endOfWeek | () | method |
public static function endOfWeek(date:Date):DateReturns the last day of the week.
Parameters
date:Date |
Date — last day of the week
|
| EuropeanStringToDate | () | method |
public static function EuropeanStringToDate(aString:String):DateCreates a Date object and initializes it using the passed string. The expected format is DD/MM/YYYY (no time) or DD/MM/YYYY HH:NN:SS Numbers can have less than 2 digits NOTE: has to be reviewed as it is locale dependent (european date format)
Parameters
aString:String — String representation of the date
|
Date — Date object, or null if an error occurs
|
| getCompleteDateTimeToString | () | method |
public static function getCompleteDateTimeToString(date:Date):StringReturn complete date and time with seconds & milliseconds. Date formats is:
Parameters
date:Date — date to format
|
String — formatted string
|
| getDateDayIndex | () | method |
public static function getDateDayIndex(date:Date):intReturn the day index of a date according to the FIRST_DAY_OF_WEEK variable. This index corresponds to the month/week column of the day.
Parameters
date:Date — date to analyze
|
int — the day index (0 for the first day, 6 for the last one)
|
| getDateFormatString | () | method |
public static function getDateFormatString():StringReturn date format string. Date format is:
String — date format string
|
| getDateRangeToString | () | method |
public static function getDateRangeToString(range:DateRange):StringReturn date range string. This string is used in control bar date label in week view. Date format is:
Parameters
range:DateRange — date range format
|
String — formatted string
|
| getDateToString | () | method |
public static function getDateToString(date:Date):StringReturn date string (without time). Date format is:
Parameters
date:Date — date to format
|
String — formatted string
|
| getDayHeaderDateToString | () | method |
public static function getDayHeaderDateToString(date:Date, format:int):StringReturn date day string (number by default). This string is used in day headers of day/week/month views. By default, short format is used for all days except first & last day of months, first & last days of week in week view, day in day view that use medium format. But if displayMonthNamesInAllDays property is set to true medium format is used for all days. Long format is used for first & last days of years. Short format is:
Parameters
date:Date — date to format
| |
format:int (default = NaN) — indicates which format should be used (available values are DAY_DATE_SHORT_FORMAT, DAY_DATE_MEDIUM_FORMAT & DAY_DATE_LONG_FORMAT).
|
String — formatted string
|
| getDayHeaderDayToStringByDayNumber | () | method |
public static function getDayHeaderDayToStringByDayNumber(day:int):StringReturn day date string (string by default). This string is used in day headers of day/week/month views. String are:
Parameters
day:int — day number (0 is Sunday)
|
String — formatted string
|
| getDaysDifference | () | method |
public static function getDaysDifference(date1:Date, date2:Date):intReturns day count between 2 dates. Only dates are taken in account (not hours, minutes...). i.e: getDaysDifference(3 March, 5 March) returns - 2
Parameters
date1:Date — first date
| |
date2:Date — second date
|
int — days count difference
|
| getFirstDayOfYear | () | method |
public static function getFirstDayOfYear(date:Date):DateParameters
date:Date |
Date |
| getFullDateAndTimeToEuropeanString | () | method |
public static function getFullDateAndTimeToEuropeanString(date:Date):StringReturn date formatted to european string ("D/MM/YYYY JJ:NN").
Parameters
date:Date — date to format
|
String — formatted string
|
| getFullDateAndTimeToString | () | method |
public static function getFullDateAndTimeToString(date:Date):StringReturn full date & time string. This string is used in default item renderer tooltip to format dates. Date formats is:
Parameters
date:Date — date to format
|
String — formatted string
|
| getFullDayMonthYearToString | () | method |
public static function getFullDayMonthYearToString(date:Date):StringReturn full day, month & year string. This string is used in control bar date label in day view and in default mouse selection tooltip. Date formats is:
Parameters
date:Date — date to format
|
String — formatted string
|
| getFullDayToStringByDayNumber | () | method |
public static function getFullDayToStringByDayNumber(day:int):StringReturn day to string. This string (first letter) is used for KCMiniCalendar component to display days letters in column headers and, by default, for day cell headers. Strings correspond to dayNames properties in SharedResources bundle.
Parameters
day:int — day number (0 is Sunday)
|
String — formatted string
|
| getFullYearToString | () | method |
public static function getFullYearToString(date:Date):StringReturn full year string. This string is used in control bar date label in year view. Date formats is:
Parameters
date:Date — date to format
|
String — formatted string
|
| getHourToString | () | method |
public static function getHourToString(date:Date):StringRetour hour to string. This string is used in day and week views hour grid, default renderer hours labels, & mouse selection default tooltip.
Parameters
date:Date — date to format
|
String — formatted string
|
| getLastDayOfMonth | () | method |
public static function getLastDayOfMonth(date:Date):DateReturn the last day of month.
Parameters
date:Date — date in a month.
|
Date — last day of month.
|
| getLastDayOfMonthDate | () | method |
public static function getLastDayOfMonthDate(date:Date):intReturn the last day of month date.
Parameters
date:Date — date in a month.
|
int — last day of month date.
|
| getMonthAndYearToString | () | method |
public static function getMonthAndYearToString(date:Date):StringReturn date month & year to string. This string is used for control bar label in month view and for KCMiniCalendar component to display current month label. Date formats is:
Parameters
date:Date — date to format
|
String — formatted string
|
| getMonthCellDayToString | () | method |
public static function getMonthCellDayToString(date:Date):StringReturn date day to string. This string is used for days labels in year view. Date formats is:
Parameters
date:Date — date to format
|
String — formatted string
|
| getNextMonthDate | () | method |
public static function getNextMonthDate(date:Date):DateReturn the next month date according to a given date. Note that if next month has too less days, the last day of next month will be returned (i.e: 28th of February for 29th/30th/31st of January).
Parameters
date:Date — date in a month.
|
Date — last day of month date.
|
| getNextSameDateInMonth | () | method |
public static function getNextSameDateInMonth(date:Date):DateReturns the next same day date in month
Parameters
date:Date — : current date
|
Date — null if the next same day date is not in the same month
|
| getWeekNumber | () | method |
public static function getWeekNumber(date:Date):intGet date week number.
Parameters
date:Date |
int — week number.
|
| getYearMonthToString | () | method |
public static function getYearMonthToString(date:Date):StringReturn date month to string. This string is used for month header labels in year view & for KCMiniCalendar component months combobox. Date formats is:
Parameters
date:Date — date to format
|
String — formatted string
|
| isDayAfter | () | method |
public static function isDayAfter(date1:Date, date2:Date):BooleanReturns if date1 day is after date2 day in time.
Parameters
date1:Date — date to check against date2
| |
date2:Date — date to check against date1
|
Boolean — true if date1 is prior to date2 (false if days are the same)
|
| isDayBefore | () | method |
public static function isDayBefore(date1:Date, date2:Date):BooleanReturns if date1 day is before date2 day in time.
Parameters
date1:Date — date to check against date2
| |
date2:Date — date to check against date1
|
Boolean — true if date1 is prior to date2 (false if days are the same)
|
| isoToDate | () | method |
public static function isoToDate(value:String):DateReturn date corresponding to given ISO string date (i.e: 2009-09-22T15:00:00.000Z).
Parameters
value:String — ISO string date
|
Date — date
|
| isSameDate | () | method |
public static function isSameDate(date1:Date, date2:Date):BooleanReturns if 2 dates are the same (no reference comparison, only date & time). Note: dates can be null.
Parameters
date1:Date — first date
| |
date2:Date — second date
|
Boolean — true if dates are the same
|
| isSameDay | () | method |
public static function isSameDay(date1:Date, date2:Date, checkSpecial:Boolean = false):BooleanReturns if 2 dates have the same day (no hours/min/sec/ms comparison)
Parameters
date1:Date — first date
| |
date2:Date — second date
| |
checkSpecial:Boolean (default = false) — indicates if full day special test should be done
|
Boolean — true if days are the same
Important note: special full day event are described with a end date set at day+1 but with 00:00 as hour/minutes
So if checkSpecial is set to true xx/yy will be considered as same day as xx+1/y 00:00
|
| isSameMonth | () | method |
public static function isSameMonth(date1:Date, date2:Date):BooleanReturns if 2 dates have the same month (no date/hours/min/sec/ms comparison, only year & month)
Parameters
date1:Date — first date
| |
date2:Date — second date
|
Boolean — true if months are the same
|
| isSpecialFullDayDate | () | method |
public static function isSpecialFullDayDate(date:Date):BooleanReturns if a date is set to 0h00
Parameters
date:Date — date to test
|
Boolean — true if date is a special full day end date
|
| isTommorow | () | method |
public static function isTommorow(date1:Date, date2:Date):BooleanReturns if date1 is date2 tomorrow.
Parameters
date1:Date — date to check against date2
| |
date2:Date — date to check against date1
|
Boolean — true if date1 is date2 tomorrow
|
| middleOfWeek | () | method |
public static function middleOfWeek(date:Date):DateReturns the middle day of the week (4th day in the week).
Parameters
date:Date |
Date — last day of the week
|
| parseTime | () | method |
public static function parseTime(value:String, guessAMPM:Boolean = false):DateParse a time string and convert it to a Date (date part is always 01/01/2000).
Parameters
value:String — time in string
| |
guessAMPM:Boolean (default = false) — if time detected is less or equal to 6, returned time value is PM.
|
Date — time as Date
|
| removeSecondsAndMilliseconds | () | method |
public static function removeSecondsAndMilliseconds(value:Date):voidSets seconds & milliseconds to 0 in a Date.
Parameters
value:Date — date to change.
|
| resetFormatters | () | method |
public static function resetFormatters():voidReset all formatters (called internally upon resourceChanged event) in order to apply locale formats.
| startOfWeek | () | method |
public static function startOfWeek(date:Date):DateReturns the first day of the week.
Parameters
date:Date |
Date — first day of the week
|
| DAY_DATE_LONG_FORMAT | Constant |
public static const DAY_DATE_LONG_FORMAT:int = 2| DAY_DATE_MEDIUM_FORMAT | Constant |
public static const DAY_DATE_MEDIUM_FORMAT:int = 1| DAY_DATE_SHORT_FORMAT | Constant |
public static const DAY_DATE_SHORT_FORMAT:int = 0| FRIDAY | Constant |
public static const FRIDAY:uint = 5| MONDAY | Constant |
public static const MONDAY:uint = 1| MS_BY_DAY | Constant |
public static const MS_BY_DAY:int = 8.64E7| MS_BY_HOUR | Constant |
public static const MS_BY_HOUR:int = 3600000.0| MS_BY_MINUTES | Constant |
public static const MS_BY_MINUTES:int = 60000.0| SATURDAY | Constant |
public static const SATURDAY:uint = 6| SUNDAY | Constant |
public static const SUNDAY:uint = 0| THURSDAY | Constant |
public static const THURSDAY:uint = 4| TUESDAY | Constant |
public static const TUESDAY:uint = 2| WEDNESDAY | Constant |
public static const WEDNESDAY:uint = 3