Properties Methods Events Direct Link

# Class Ext.ensible.cal.Date

Package: | Ext.ensible.cal
Defined In: | Extensible.js
Class: | Date
Extends: | Object

Contains utility date functions used by the calendar components.

This class is a singleton and cannot be created directly.

## Public Properties

Property | Defined By
--- | ---
| use24HourTime : Boolean Determines whether times used throughout all Extensible components should be displayed as 12 hour times with am/pm (d... Determines whether times used throughout all Extensible components should be displayed as 12 hour times with am/pm (default) or 24 hour / military format. Note that some locale files may override this value by default. | Date

## Public Methods

Method | Defined By
--- | ---
| compare( `Date dt1`, `Date dt2`, [`Boolean precise`] ) : Number Compares two dates and returns a value indicating how they relate to each other. Compares two dates and returns a value indicating how they relate to each other. Parameters: `dt1` : Date The first date `dt2` : Date The second date `precise` : Boolean (optional) If true, the milliseconds component is included in the comparison, else it is ignored (the default). Returns: `Number` The number of milliseconds difference between the two dates. If the dates are equal this will be 0. If the first date is earlier the return value will be positive, and if the second date is earlier the value will be negative. | Date
| copyTime( `Date fromDt`, `Date toDt` ) : Date Copies the time value from one date object into another without altering the target's date value. This function retu... Copies the time value from one date object into another without altering the target's date value. This function returns a new Date instance without modifying either original value. Parameters: `fromDt` : Date The original date from which to copy the time `toDt` : Date The target date to copy the time to Returns: `Date` The new date/time value | Date
| diff( `Date start`, `Date end`, [`String unit`] ) : Number Returns the time duration between two dates in the specified units. For finding the number of calendar days (ignoring... Returns the time duration between two dates in the specified units. For finding the number of calendar days (ignoring time) between two dates use diffDays instead. Parameters: `start` : Date The start date `end` : Date The end date `unit` : String (optional) The time unit to return. Valid values are 'ms' (milliseconds, the default), 's' (seconds), 'm' (minutes) or 'h' (hours). Returns: `Number` The time difference between the dates in the units specified by the unit param | Date
| diffDays( `Date start`, `Date end` ) : Number Calculates the number of calendar days between two dates, ignoring time values. A time span that starts at 11pm (23:... Calculates the number of calendar days between two dates, ignoring time values. A time span that starts at 11pm (23:00) on Monday and ends at 1am (01:00) on Wednesday is only 26 total hours, but it spans 3 calendar days, so this function would return 3. For the exact time difference, use diff instead. Parameters: `start` : Date The start date `end` : Date The end date Returns: `Number` The number of calendar days difference between the dates | Date
| isWeekday( `Date dt` ) : Boolean Returns true if the specified date falls on a Monday through Fridey, else false. Returns true if the specified date falls on a Monday through Fridey, else false. Parameters: `dt` : Date The date to test Returns: `Boolean` True if the date is a week day, else false | Date
| isWeekend( `Date dt` ) : Boolean Returns true if the specified date is a Saturday or Sunday, else false. Returns true if the specified date is a Saturday or Sunday, else false. Parameters: `dt` : Date The date to test Returns: `Boolean` True if the date is a weekend day, else false | Date
| max( `Date dt1`, `Date dt2`, [`Date dtN`] ) : Date Returns the maximum date value passed into the function. Any number of date objects can be passed as separate params... Returns the maximum date value passed into the function. Any number of date objects can be passed as separate params. Parameters: `dt1` : Date The first date `dt2` : Date The second date `dtN` : Date (optional) The Nth date, etc. Returns: `Date` A new date instance with the latest date value that was passed to the function | Date
| min( `Date dt1`, `Date dt2`, [`Date dtN`] ) : Date Returns the minimum date value passed into the function. Any number of date objects can be passed as separate params... Returns the minimum date value passed into the function. Any number of date objects can be passed as separate params. Parameters: `dt1` : Date The first date `dt2` : Date The second date `dtN` : Date (optional) The Nth date, etc. Returns: `Date` A new date instance with the earliest date value that was passed to the function | Date
| rangesOverlap( `Date start1`, `Date end1`, `Date start2`, `Date end2` ) : Booelan Returns true if two date ranges overlap (either one starts or ends within the other, or one completely overlaps the s... Returns true if two date ranges overlap (either one starts or ends within the other, or one completely overlaps the start and end of the other), else false if they do not. Parameters: `start1` : Date The start date of range 1 `end1` : Date The end date of range 1 `start2` : Date The start date of range 2 `end2` : Date The end date of range 2 Returns: `Booelan` True if the ranges overlap, else false | Date

## Public Events

This class has no public events.