dojox/date/buddhist/Date.js

  • Provides:

    • dojox.date.buddhist.Date
  • dojox.date.buddhist.Date

    • type
      Function
    • source: [view]
        var len = arguments.length;
        if(!len){// use the current date value, added "" to the similarity to date
         this.fromGregorian(new Date());
        }else if(len == 1){
         var arg0 = arguments[0];
         if(typeof arg0 == "number"){ // this is time "valueof"
          arg0 = new Date(arg0);
         }


         if(arg0 instanceof Date){
          this.fromGregorian(arg0);
         }else if(arg0 == ""){
          this._date = new Date("");
         }else{
          this._year = arg0._year;
          this._month = arg0._month;
          this._date = arg0._date;
          this._hours = arg0._hours;
          this._minutes = arg0._minutes;
          this._seconds = arg0._seconds;
          this._milliseconds = arg0._milliseconds;
         }
        }else if(len >=3){
         this._year += arguments[0];
         this._month += arguments[1];
         this._date += arguments[2];

         
         if(this._month >11){
          console.warn("the month is incorrect , set 0");
          this._month = 0;
         }
         this._hours += arguments[3] || 0;
         this._minutes += arguments[4] || 0;
         this._seconds += arguments[5] || 0;
         this._milliseconds += arguments[6] || 0;
        }
    • summary
      This is the constructor
    • description
      This fucntion initialize the date object values
    • example
      
      		var date1 = new dojox.date.buddhist.Date();
      
      		var date2 = new dojox.date.buddhist.Date(date1);
      
      		var date3 = new dojox.date.buddhist.Date(2552,2,12);
  • dojox.date.buddhist.Date._date

    • summary
  • dojox.date.buddhist.Date._month

    • summary
  • dojox.date.buddhist.Date._year

    • summary
  • dojox.date.buddhist.Date._hours

    • summary
  • dojox.date.buddhist.Date._minutes

    • summary
  • dojox.date.buddhist.Date._seconds

    • summary
  • dojox.date.buddhist.Date._milliseconds

    • summary
  • dojox.date.buddhist.Date._day

    • summary
  • dojox.date.buddhist.Date.getDate

    • type
      Function
    • parameters:
      • isNumber: (typeof boolean)
    • source: [view]
        return parseInt(this._date);
    • summary
      This function returns the date value (0 - 30)
    • example
      
      		var date1 = new dojox.date.buddhist.Date();
      
      		console.log(date1.getDate());
  • dojox.date.buddhist.Date.getMonth

    • type
      Function
    • source: [view]
        return parseInt(this._month);
    • summary
      This function return the month value ( 0 - 11 )
    • example
      
      		var date1 = new dojox.date.buddhist.Date();
      
      		console.log(date1.getMonth()+1);
  • dojox.date.buddhist.Date.getFullYear

    • type
      Function
    • source: [view]
        return parseInt(this._year);
    • summary
      This function return the Year value
    • example
      
      		var date1 = new dojox.date.buddhist.Date();
      
      		console.log(date1.getFullYear());
  • dojox.date.buddhist.Date.getHours

    • type
      Function
    • source: [view]
        return this._hours;
    • summary
      returns the Hour value
  • dojox.date.buddhist.Date.getMinutes

    • type
      Function
    • source: [view]
        return this._minutes;
    • summary
      returns the Minuites value
  • dojox.date.buddhist.Date.getSeconds

    • type
      Function
    • source: [view]
        return this._seconds;
    • summary
      returns the seconde value
  • dojox.date.buddhist.Date.getMilliseconds

    • type
      Function
    • source: [view]
        return this._milliseconds;
    • summary
      returns the Milliseconds value
  • dojox.date.buddhist.Date.setDate

    • type
      Function
    • parameters:
      • date: (typeof number)
    • source: [view]
        date = parseInt(date);


        if(date > 0 && date <= this._getDaysInMonth(this._month, this._year)){
         this._date = date;
        }else{
         var mdays;
         if(date>0){
          for(mdays = this._getDaysInMonth(this._month, this._year);
           date > mdays;
            date -= mdays,mdays = this._getDaysInMonth(this._month, this._year)){
           this._month++;
           if(this._month >= 12){this._year++; this._month -= 12;}
          }


          this._date = date;
         }else{
          for(mdays = this._getDaysInMonth((this._month-1)>=0 ?(this._month-1) :11 ,((this._month-1)>=0)? this._year: this._year-1);
            date <= 0;
             mdays = this._getDaysInMonth((this._month-1)>=0 ? (this._month-1) :11,((this._month-1)>=0)? this._year: this._year-1)){
           this._month--;
           if(this._month < 0){this._year--; this._month += 12;}


           date+=mdays;
          }
          this._date = date;
         }
        }
        return this;
    • summary
      This function sets the Date
    • example
      
      		var date1 = new dojox.date.buddhist.Date();
      		date1.setDate(2);
  • dojox.date.buddhist.Date.setFullYear

    • type
      Function
    • parameters:
      • year: (typeof number)
      • month: (typeof number)
      • date: (typeof number)
    • source: [view]
        this._year = parseInt(year);
    • summary
      This function set Year
    • example
      
      		var date1 = new dojox.date.buddhist.Date();
      		date1.setFullYear(2552);
      		date1.setFullYear(2552, 1, 1);
  • dojox.date.buddhist.Date.setMonth

    • type
      Function
    • parameters:
      • month: (typeof number)
    • source: [view]
        this._year += Math.floor(month / 12);
        this._month = Math.floor(month % 12);
        for(; this._month < 0; this._month = this._month+12);
    • summary
      This function set Month
    • example
      
      		var date1 = new dojox.date.buddhist.Date();
      		date1.setMonth(0); //first month
  • dojox.date.buddhist.Date.setHours

    • type
      Function
    • source: [view]
        var hours_arg_no = arguments.length;
        var hours = 0;
        if(hours_arg_no >= 1){
         hours = parseInt(arguments[0]);
        }

         
        if(hours_arg_no >= 2){
         this._minutes = parseInt(arguments[1]);
        }

         
        if(hours_arg_no >= 3){
         this._seconds = parseInt(arguments[2]);
        }

         
        if(hours_arg_no == 4){
         this._milliseconds = parseInt(arguments[3]);
        }

            
        while(hours >= 24){
         this._date++;
         var mdays = this._getDaysInMonth(this._month, this._year);
         if(this._date > mdays){
           this._month ++;
           if(this._month >= 12){this._year++; this._month -= 12;}
           this._date -= mdays;
         }
         hours -= 24;
        }
        this._hours = hours;
    • summary
      set the Hours  0-23
  • dojox.date.buddhist.Date.setMinutes

    • type
      Function
    • parameters:
      • minutes: (typeof number)
    • source: [view]
        while(minutes >= 60){
         this._hours++;
         if(this._hours >= 24){
          this._date++;
          this._hours -= 24;
          var mdays = this._getDaysInMonth(this._month, this._year);
          if(this._date > mdays){
            this._month ++;
            if(this._month >= 12){this._year++; this._month -= 12;}
            this._date -= mdays;
          }
         }
         minutes -= 60;
        }
        this._minutes = minutes;
    • summary
      set the Minutes  frm 0-59
  • dojox.date.buddhist.Date.setSeconds

    • type
      Function
    • parameters:
      • seconds: (typeof number)
    • source: [view]
        while(seconds >= 60){
         this._minutes++;
         if(this._minutes >= 60){
          this._hours++;
          this._minutes -= 60;
          if(this._hours >= 24){
           this._date++;
           this._hours -= 24;
           var mdays = this._getDaysInMonth(this._month, this._year);
           if(this._date > mdays){
            this._month ++;
            if(this._month >= 12){this._year++; this._month -= 12;}
            this._date -= mdays;
           }
          }
         }
         seconds -= 60;
        }
        this._seconds = seconds;
    • summary
      set the Seconds  from 0-59
  • dojox.date.buddhist.Date.setMilliseconds

    • type
      Function
    • parameters:
      • milliseconds: (typeof number)
    • source: [view]
        while(milliseconds >= 1000){
         this.setSeconds++;
         if(this.setSeconds >= 60){
          this._minutes++;
          this.setSeconds -= 60;
          if(this._minutes >= 60){
           this._hours++;
           this._minutes -= 60;
           if(this._hours >= 24){
            this._date++;
            this._hours -= 24;
            var mdays = this._getDaysInMonth(this._month, this._year);
          if(this._date > mdays){
           this._month ++;
           if(this._month >= 12){this._year++; this._month -= 12;}
           this._date -= mdays;
           }
          }
         }
        }
         milliseconds -= 1000;
        }
        this._milliseconds = milliseconds;
    • summary
      set the milliseconds
  • dojox.date.buddhist.Date.toString

    • type
      Function
    • source: [view]
        return this._date + ", " + this._month + ", " + this._year + " " + this._hours + ":" + this._minutes + ":" + this._seconds; // String
    • summary
      This returns a string representation of the date in &quot;dd, MM, YYYY HH:MM:SS&quot; format
    • returns
      String
  • dojox.date.buddhist.Date._getDaysInMonth

    • type
      Function
    • parameters:
      • month: (typeof number)
      • year: (typeof number)
    • source: [view]
        return dojo.date.getDaysInMonth(new Date(year-543, month));
    • summary
  • dojox.date.buddhist.Date.fromGregorian

    • type
      Function
    • parameters:
      • gdate: (typeof Date)
    • source: [view]
        var date = new Date(gdate);
        this._date = date.getDate();
        this._month = date.getMonth();
        this._year = date.getFullYear()+543;
        this._hours = date.getHours();
        this._minutes = date.getMinutes();
        this._seconds = date.getSeconds();
        this._milliseconds = date.getMilliseconds();
        this._day = date.getDay();
        return this;
    • summary
      This function sets this Date to the Hebrew Date corresponding to the Gregorian Date
  • dojox.date.buddhist.Date.toGregorian

    • type
      Function
    • source: [view]
        return new Date(this._year-543, this._month, this._date, this._hours, this._minutes, this._seconds, this._milliseconds); // Date
    • summary
      This returns the equivalent Gregorian date value as a Date object
    • returns
      Date
  • dojox.date.buddhist.Date.getDay

    • type
      Function
    • source: [view]
        return this.toGregorian().getDay(); // int
    • summary
      This function return Week Day value ( 0 - 6 )
    • returns
      int
  • dojox.date.buddhist.Date.valueOf

    • type
      Function
    • source: [view]
       return this.toGregorian().valueOf();
    • summary
  • dojox.date.buddhist

    • type
      Object
    • summary
  • dojox.date

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary