Пример #1
0
        static void OnReady()
        {
            var today = new JsDate();
            var birthdays = new JsArray<JsNumber> {
                new JsDate(today.getFullYear(), today.getMonth(), 11).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 6).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 27).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 1, 3).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 2, 22).valueOf()
 
            };
                    new jQuery("#datepicker").kendoDatePicker(new DatePickerConfiguration {
                        value = today,
                        month=  new MonthConfiguration {
                            // template for dates in month view
                            content = "# if ($.inArray(+data.date, [" + birthdays + "]) != -1) { #" +
                                         "<div class='birthday'></div>" +
                                     "# } #" +
                                     "#= data.value #"
                        },
                        footer = "Today - #=kendo.toString(data, 'd') #"
                    });

                    new jQuery("#datepicker").data("kendoDatePicker").As<DatePicker>();
                                    //TODO: .dateView.calendar.element
                                    //.width(300);
                

        }
Пример #2
0
 private static JsDate GetDate(int? year, int month, int date) 
 {
     var d = new JsDate();
     if (year != null) {
         d.setFullYear(year.Value);
     }
     d.setMonth(month);
     d.setDate(date);
     return d;
 }
Пример #3
0
        static void startChange()
        {
            var startDate = DatePickerGlobals.start.value().As<JsDate>();

            if (startDate.As<JsBoolean>())
            {
                startDate = new JsDate(startDate.As<JsString>());
                startDate.setDate(startDate.getDate() + 1);
                DatePickerGlobals.end.min(startDate);
            }
        }
Пример #4
0
        static void endChange()
        {
            var endDate = DatePickerGlobals.end.value().As<JsDate>();

            if (endDate.As<JsBoolean>())
            {
                endDate = new JsDate(endDate.As<JsString>());
                endDate.setDate(endDate.getDate() + 1);
                DatePickerGlobals.start.min(endDate);
            }
        }
Пример #5
0
        /// <summary>
        /// Checks whether a given date is in daylight saving time.
        /// If the date supplied is after august, we assume that we're checking
        /// for southern hemisphere DST.
        /// </summary>
        private static bool DateIsDst(JsDate date) 
        {
            var is_southern = date.getMonth() > 7;
            var base_offset = is_southern ? GetJuneOffset(date.getFullYear()) : GetJanuaryOffset(date.getFullYear());
            var date_offset = GetDateOffset(date);
            var is_west = base_offset < 0;
            var dst_offset = base_offset - date_offset;
                  
            if (!is_west && !is_southern) {
                return dst_offset < 0;
            }

            return dst_offset != 0;
        }
Пример #6
0
        static void OnReady()
        {
            var today = new JsDate();
            var birthdays = new JsArray<JsNumber> {
                new JsDate(today.getFullYear(), today.getMonth(), 8).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth(), 12).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth(), 24).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 6).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 7).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 25).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 27).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 1, 3).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 1, 5).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 2, 22).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 2, 27).valueOf()
            };
            new jQuery("#calendar").kendoCalendar(new CalendarConfiguration
            {
                value = today,
                dates = birthdays,
                month = new MonthConfiguration
                {
                    // template for dates in month view
                    content = "# if ($.inArray(+data.date, data.dates) != -1) { #" +
                                        "<div class='" +
                                           "# if (data.value < 10) { #" +
                                               "exhibition" +
                                           "# } else if ( data.value < 20 ) { #" +
                                               "party" +
                                           "# } else { #" +
                                               "cocktail" +
                                           "# } #" +
                                        "'></div>" +
                                     "# } #" +
                                     "#= data.value #"

                },
                footer = "Today - #=kendo.toString(data, 'd') #"
            });
        }
Пример #7
0
 public JsString From(JsDate date, bool withoutSuffix = false)
 {
     return(null);
 }
Пример #8
0
 /// <summary>
 /// Update the selected cell
 /// </summary>
 /// <param name="date"><p>The new date</p>
 /// </param>
 private void selectedUpdate(JsDate date){}
Пример #9
0
 /// <summary>
 /// Checks if the current date is affected by Daylight Saving Time (DST).
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="bool">Boolean</see></span><div><p>True if the current date is affected by DST.</p>
 /// </div>
 /// </returns>
 public static bool isDST(JsDate date){return false;}
Пример #10
0
 /// <summary>
 /// Get the offset from GMT of the current date (equivalent to the format specifier 'O').
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <param name="colon"><p>true to separate the hours and minutes with a colon (defaults to false).</p>
 /// </param>
 /// <returns>
 /// <span><see cref="String">String</see></span><div><p>The 4-character offset string prefixed with + or - (e.g. '-0600').</p>
 /// </div>
 /// </returns>
 public static JsString getGMTOffset(JsDate date, object colon=null){return null;}
Пример #11
0
 /// <summary>
 /// Creates and returns a new Date instance with the exact same date value as the called instance.
 /// Dates are copied and passed by reference, so if a copied date variable is modified later, the original
 /// variable will also be changed.  When the intention is to create a new variable that will not
 /// modify the original instance, you should create a clone.
 /// Example of correctly cloning a date:
 /// <code>//wrong way:
 /// var orig = new Date('10/1/2006');
 /// var copy = orig;
 /// copy.setDate(5);
 /// console.log(orig);  //returns 'Thu Oct 05 2006'!
 /// //correct way:
 /// var orig = new Date('10/1/2006'),
 /// copy = <see cref="Ext.Date.clone">Ext.Date.clone</see>(orig);
 /// copy.setDate(5);
 /// console.log(orig);  //returns 'Thu Oct 01 2006'
 /// </code>
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Date">Date</see></span><div><p>The new Date instance.</p>
 /// </div>
 /// </returns>
 public static JsDate clone(JsDate date){return null;}
Пример #12
0
 /// <summary>
 /// Set the minValue and update the list of available times. This must be a Date object (only the time
 /// fields will be used); no parsing of String values will be done.
 /// </summary>
 /// <param name="value">
 /// </param>
 public void setMinValue(JsDate value){}
        public void ValueOfWorks()
        {
            var dt = new JsDate(DateTime.Utc(1970, 0, 2));

            Assert.AreEqual(dt.ValueOf(), 1440 * 60 * 1000);
        }
        public void GetTimeWorks()
        {
            var dt = new JsDate(DateTime.Utc(1970, 0, 2));

            Assert.AreEqual(dt.GetTime(), 1440 * 60 * 1000);
        }
        public void GetSecondsWorks()
        {
            var dt = new JsDate(2011, 7, 12, 13, 42, 56, 345);

            Assert.AreEqual(dt.GetSeconds(), 56);
        }
        public void DefaultConstructorReturnsTodaysDate()
        {
            var dt = new JsDate();

            Assert.IsTrue(dt.GetFullYear() > 2011);
        }
        public void GetMinutesWorks()
        {
            var dt = new JsDate(2011, 7, 12, 13, 42, 56, 345);

            Assert.AreEqual(dt.GetMinutes(), 42);
        }
        public void GetHoursWorks()
        {
            var dt = new JsDate(2011, 7, 12, 13, 42, 56, 345);

            Assert.AreEqual(dt.GetHours(), 13);
        }
Пример #19
0
 /// <summary>
 /// Sets the year/month/day of the given Date object to the initDate, so that only
 /// the time fields are significant. This makes values suitable for time comparison.
 /// </summary>
 /// <param name="date">
 /// </param>
 private void normalizeDate(JsDate date){}
        public void GetTimezoneOffsetWorks()
        {
            var dt = new JsDate(0);

            Assert.AreEqual(dt.GetTimezoneOffset(), new JsDate(1970, 0, 1).ValueOf() / 60000);
        }
Пример #21
0
 /// <summary>
 /// Checks if a date falls on or between the given start and end dates.
 /// </summary>
 /// <param name="date"><p>The date to check</p>
 /// </param>
 /// <param name="start"><p>Start date</p>
 /// </param>
 /// <param name="end"><p>End date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="bool">Boolean</see></span><div><p>true if this date falls on or between the given start and end dates.</p>
 /// </div>
 /// </returns>
 public static bool between(JsDate date, JsDate start, JsDate end){return false;}
        public void GetUtcFullYearWorks()
        {
            var dt = new JsDate(DateTime.Utc(2011, 7, 12, 13, 42, 56, 345));

            Assert.AreEqual(dt.GetUtcFullYear(), 2011);
        }
Пример #23
0
 /// <summary>
 /// Get the number of days in the current month, adjusted for leap year.
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Number">Number</see></span><div><p>The number of days in the month.</p>
 /// </div>
 /// </returns>
 public static JsNumber getDaysInMonth(JsDate date){return null;}
        public void GetUtcMillisecondsWorks()
        {
            var dt = new JsDate(DateTime.Utc(2011, 7, 12, 13, 42, 56, 345));

            Assert.AreEqual(dt.GetUtcMilliseconds(), 345);
        }
        public void GetMonthWorks()
        {
            var dt = new JsDate(2011, 7, 12, 13, 42, 56, 345);

            Assert.AreEqual(dt.GetMonth(), 7);
        }
        public void GetUtcDayWorks()
        {
            var dt = new JsDate(DateTime.Utc(2011, 7, 12, 13, 42, 56, 345));

            Assert.AreEqual(dt.GetUtcDay(), 5);
        }
Пример #27
0
 /// <summary>
 /// Checks if the current date falls within a leap year.
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="bool">Boolean</see></span><div><p>True if the current date falls within a leap year, false otherwise.</p>
 /// </div>
 /// </returns>
 public static bool isLeapYear(JsDate date){return false;}
        public void MillisecondSinceEpochConstructorWorks()
        {
            var dt = new JsDate(1440L * 60 * 500 * 1000);

            Assert.AreEqual(dt.GetFullYear(), 1971);
        }
Пример #29
0
 /// <summary>
 /// Update the contents of the picker
 /// </summary>
 /// <param name="date"><p>The new date</p>
 /// </param>
 /// <param name="forceRefresh"><p>True to force a full refresh</p>
 /// </param>
 private void update(JsDate date, bool forceRefresh){}
 public void FromUtcYMDHNWorks()
 {
     AssertDateUtc(JsDate.FromUtc(2011, 7, 12, 13, 42), 2011, 7, 12, 13, 42, 0, 0);
 }
Пример #31
0
 public LoggingEvent(Logger logger, JsDate timeStamp, Level level, JsArray messages, JsError exception)
 {
 }
 public void FromUtcYMDHNSUWorks()
 {
     AssertDateUtc(JsDate.FromUtc(2011, 7, 12, 13, 42, 56, 345), 2011, 7, 12, 13, 42, 56, 345);
 }
Пример #33
0
 public Moment(JsDate date)
 {
 }
Пример #34
0
 [InlineCode("{this}({date})")]          public string Filter(JsDate date)
 {
     return(null);
 }
Пример #35
0
 [InlineCode("{this}({date},{format})")] public string Filter(JsDate date, string format)
 {
     return(null);
 }
Пример #36
0
 public static IObservable <long> timer(JsDate dueTime, long period = -1, IScheduler scheduler = null)
 {
     return(null);
 }
Пример #37
0
 /// <summary>
 /// Set the maxValue and update the list of available times. This must be a Date object (only the time
 /// fields will be used); no parsing of String values will be done.
 /// </summary>
 /// <param name="value">
 /// </param>
 public void setMaxValue(JsDate value){}
Пример #38
0
 public static IObservable <TSource> timeout <TSource>(this IObservable <TSource> source, JsDate dueTime, IScheduler scheduler)
 {
     return(null);
 }
Пример #39
0
 /// <summary>
 /// Provides a convenient method for performing basic date arithmetic. This method
 /// does not modify the Date instance being called - it creates and returns
 /// a new Date instance containing the resulting date value.
 /// Examples:
 /// <code>// Basic usage:
 /// var dt = <see cref="Ext.Date.add">Ext.Date.add</see>(new Date('10/29/2006'), <see cref="Ext.Date.DAY">Ext.Date.DAY</see>, 5);
 /// console.log(dt); //returns 'Fri Nov 03 2006 00:00:00'
 /// // Negative values will be subtracted:
 /// var dt2 = <see cref="Ext.Date.add">Ext.Date.add</see>(new Date('10/1/2006'), <see cref="Ext.Date.DAY">Ext.Date.DAY</see>, -5);
 /// console.log(dt2); //returns 'Tue Sep 26 2006 00:00:00'
 /// </code>
 /// </summary>
 /// <param name="date"><p>The date to modify</p>
 /// </param>
 /// <param name="interval"><p>A valid date interval enum value.</p>
 /// </param>
 /// <param name="value"><p>The amount to add to the current date.</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Date">Date</see></span><div><p>The new Date instance.</p>
 /// </div>
 /// </returns>
 public static JsDate add(JsDate date, JsString interval, JsNumber value){return null;}
Пример #40
0
 public static IObservable <long> timer(JsDate dueTime, IScheduler scheduler)
 {
     return(null);
 }
Пример #41
0
 /// <summary>
 /// Attempts to clear all time information from this Date by setting the time to midnight of the same day,
 /// automatically adjusting for Daylight Saving Time (DST) where applicable.
 /// (note: DST timezone information for the browser's host operating system is assumed to be up-to-date)
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <param name="clone"><p>true to create a clone of this date, clear the time and return it (defaults to false).</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Date">Date</see></span><div><p>this or the clone.</p>
 /// </div>
 /// </returns>
 public static JsDate clearTime(JsDate date, object clone=null){return null;}
Пример #42
0
 public static IObservable <TSource> delay <TSource>(this IObservable <TSource> source, JsDate dueTime, IScheduler scheduler = null)
 {
     return(null);
 }
Пример #43
0
 /// <summary>
 /// Formats a date given the supplied format string.
 /// </summary>
 /// <param name="date"><p>The date to format</p>
 /// </param>
 /// <param name="format"><p>The format string</p>
 /// </param>
 /// <returns>
 /// <span><see cref="String">String</see></span><div><p>The formatted date or an empty string if date parameter is not a JavaScript Date object</p>
 /// </div>
 /// </returns>
 public static JsString format(JsDate date, JsString format){return null;}
Пример #44
0
 /// <summary>
 /// Get the last day of the current month, adjusted for leap year.  The returned value
 /// is the numeric day index within the week (0-6) which can be used in conjunction with
 /// the monthNames array to retrieve the textual day name.
 /// Example:
 /// <code>var dt = new Date('1/10/2007'),
 /// lastDay = <see cref="Ext.Date.getLastDayOfMonth">Ext.Date.getLastDayOfMonth</see>(dt);
 /// console.log(<see cref="Ext.Date.dayNames">Ext.Date.dayNames</see>[lastDay]); //output: 'Wednesday'
 /// </code>
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Number">Number</see></span><div><p>The day number (0-6).</p>
 /// </div>
 /// </returns>
 public static JsNumber getLastDayOfMonth(JsDate date){return null;}
Пример #45
0
 /// <summary>
 /// Returns the number of milliseconds between two dates
 /// </summary>
 /// <param name="dateA"><p>The first date</p>
 /// </param>
 /// <param name="dateB"><p>The second date, defaults to now</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Number">Number</see></span><div><p>The difference in milliseconds</p>
 /// </div>
 /// </returns>
 public static JsNumber getElapsed(JsDate dateA, object dateB=null){return null;}
Пример #46
0
 /// <summary>
 /// Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').
 /// Note: The date string returned by the javascript Date object's toString() method varies
 /// between browsers (e.g. FF vs IE) and system region settings (e.g. IE in Asia vs IE in America).
 /// For a given date string e.g. "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)",
 /// getTimezone() first tries to get the timezone abbreviation from between a pair of parentheses
 /// (which may or may not be present), failing which it proceeds to get the timezone abbreviation
 /// from the GMT offset portion of the date string.
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="String">String</see></span><div><p>The abbreviated timezone name (e.g. 'CST', 'PDT', 'EDT', 'MPST' ...).</p>
 /// </div>
 /// </returns>
 public static JsString getTimezone(JsDate date){return null;}
Пример #47
0
 /// <summary>
 /// Get the date of the last day of the month in which this date resides.
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Date">Date</see></span><div>
 /// </div>
 /// </returns>
 public static JsDate getLastDateOfMonth(JsDate date){return null;}
        public void LocaleFormatWorks()
        {
            var dt = new JsDate(2011, 7, 12, 13);

            Assert.AreEqual(dt.Format("yyyy-MM-dd"), "2011-08-12");
        }
Пример #49
0
 /// <summary>
 /// Get the English ordinal suffix of the current day (equivalent to the format specifier 'S').
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="String">String</see></span><div><p>'st, 'nd', 'rd' or 'th'.</p>
 /// </div>
 /// </returns>
 public static JsString getSuffix(JsDate date){return null;}
Пример #50
0
        public static JsDate removeTime(this JsDate date)
        {
            var date2 = new JsDate(date.getFullYear(), date.getMonth(), date.getDate());

            return(date2);
        }
Пример #51
0
 /// <summary>
 /// Get the numeric ISO-8601 week number of the year.
 /// (equivalent to the format specifier 'W', but without a leading zero).
 /// </summary>
 /// <param name="date"><p>The date</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Number">Number</see></span><div><p>1 to 53</p>
 /// </div>
 /// </returns>
 public static JsNumber getWeekOfYear(JsDate date){return null;}
Пример #52
0
 public JsImplDateTime()
 {
     this.date = MinValue.date;
 }
Пример #53
0
 /// <summary>
 /// Compares if two dates are equal by comparing their values.
 /// </summary>
 /// <param name="date1">
 /// </param>
 /// <param name="date2">
 /// </param>
 /// <returns>
 /// <span><see cref="bool">Boolean</see></span><div><p>True if the date values are equal</p>
 /// </div>
 /// </returns>
 public static bool isEqual(JsDate date1, JsDate date2){return false;}
Пример #54
0
 public static string FormatDate(this JsDate date, string format = null)
 {
     return(null);
 }
Пример #55
0
 /// <summary>
 /// Update the contents of the picker for a new month
 /// </summary>
 /// <param name="date"><p>The new date</p>
 /// </param>
 private void fullUpdate(JsDate date){}
Пример #56
0
 public static string FormatISODateTimeUTC(JsDate date)
 {
     return(null);
 }
Пример #57
0
 /// <summary>
 /// Sets the value of the date field
 /// </summary>
 /// <param name="value"><p>The date to set</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Ext.picker.Date">Ext.picker.Date</see></span><div><p>this</p>
 /// </div>
 /// </returns>
 public Ext.picker.Date setValue(JsDate value){return null;}
 /// <summary>
 /// Fires when a date is selected
 /// </summary>
 /// <param name="this"><p>DatePicker</p>
 /// </param>
 /// <param name="date"><p>The selected date</p>
 /// </param>
 /// <param name="eOpts"><p>The options object passed to <see cref="Ext.util.Observable.addListener">Ext.util.Observable.addListener</see>.</p>
 /// </param>
 public void select(Ext.picker.Date @this, JsDate date, object eOpts)
 {
 }
Пример #59
0
 /// <summary>
 /// Fires when a date is selected
 /// </summary>
 /// <param name="this"><p>DatePicker</p>
 /// </param>
 /// <param name="date"><p>The selected date</p>
 /// </param>
 /// <param name="eOpts"><p>The options object passed to <see cref="Ext.util.Observable.addListener">Ext.util.Observable.addListener</see>.</p>
 /// </param>
 public void select(Ext.picker.Date @this, JsDate date, object eOpts){}
Пример #60
0
        /// <summary>
        /// Converts a date to string according to a specified format
        /// </summary>
        /// <param name="date">Date to format, can be null</param>
        /// <param name="format">Format specifier</param>
        /// <returns>Formatted date, or empty string if date is null</returns>
        public static string FormatDate(this JsDate date, string format = null)
        {
            if (date == null)
            {
                return("");
            }

            if (format == null)
            {
                format = Q.Culture.DateFormat;
            }

            Func <int, string> pad = i => i.ToString().PadLeft(2, '0');

            return(format.Replace(new Regex("dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|fff|zz?z?|\\/", "g"),
                                  delegate(string fmt)
            {
                switch (fmt)
                {
                case "/":
                    return Q.Culture.DateSeparator;

                case "hh":
                    return pad(date.GetHours() < 13 ? date.GetHours() : (date.GetHours() - 12));

                case "h":
                    return (date.GetHours() < 13 ? date.GetHours() : (date.GetHours() - 12)).As <string>();

                case "HH":
                    return pad(date.GetHours());

                case "H":
                    return date.GetHours().As <string>();

                case "mm":
                    return pad(date.GetMinutes());

                case "m":
                    return date.GetMinutes().As <string>();

                case "ss":
                    return pad(date.GetSeconds());

                case "s":
                    return date.GetSeconds().As <string>();

                case "yyyy":
                    return date.GetFullYear().As <string>();

                case "yy":
                    return date.GetFullYear().ToString().Substring(2, 4);

                case "dddd":
                    return date.As <dynamic>().GetDayName();

                case "ddd":
                    return date.As <dynamic>().GetDayName(true);

                case "dd":
                    return pad(date.GetDate());

                case "d":
                    return date.GetDate().ToString();

                case "MM":
                    return pad((date.GetMonth() + 1));

                case "M":
                    return (date.GetMonth() + 1).As <string>();

                case "t":
                    return (date.GetHours() < 12 ? "A" : "P");

                case "tt":
                    return (date.GetHours() < 12 ? "AM" : "PM");

                case "fff":
                    return (date.GetMilliseconds()).ToString().PadLeft(3, '0');

                case "zzz":
                case "zz":
                case "z":
                    return "";

                default:
                    return fmt;
                }
            }));
        }