function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ekmekm 

date and creating new event

Hi, all,

I'm attempting to create a new event and pass a string variable as an activity date from a dateField.

When I force the date, a new event is created, but when I try to save the selected date into a variable and then try to create the new event, the new event does not get created. Should I be sending a Date object instead of a string object? Is my String variable (myDateString) not formatted correctly?

If I've missed an example of this here on the threads, please point me in right direction. Otherwise, any assistance would be greatly appreciated.

Regards,

EKM


My related actionScript

// function for creating the Event
private function createEvent():void
{
 //other code for function here

// this doesn't work
//evt.ActivityDateTime = new Date(myDateString, startTimePassHour, startTimePassMinute, 0); // this doesn't work

//this does work
evt.ActivityDateTime = new Date(2008, 08, 01, startTimePassHour, startTimePassMinute, 0); // this does allow me to create new Events
       
//....code for apex.create([evt],.... goes here

}


public var myDateString:String;
  //function for saving dateMeetingAdd.text to string variable        
private function myDateToString():void
{
    myDateString = dateMeetingDateAdd.text;
    //Alert.show(myDateString);
}


//function for formatting the date
private function formatDate(date:Date):String {
                return DateDisplayApex.format(date);
            }



// Date Formatter to format the year, month, and date
<mx:DateFormatter id="DateDisplayApex"
        formatString="YYYY, MM, DD"/>

//the datefield I'm using to select a date for the event I'm creating
//calls myDateToString to save dateMeetingDateAdd to string
<mx:DateField showToday="true" id="dateMeetingDateAdd"
    labelFunction="formatDate" parseFunction="null"
    text="July 28, 2008" change="myDateToString()"/>

ekmekm
Hi all,

In case anyone is attempting to solve this, I finally stumbled across a solution:

On my datefield, I call a function on change:
convertMeetingDateAddBroker(event)

public var brokerAddEventDate:String;
public var brokerAddEventMonth:String;
public var brokerAddEventYear:String;

public function convertMeetingDateAddBroker(eventObj:CalendarLayoutChangeEvent):void
            {
                if (eventObj.currentTarget.selectedDate == null)
                {
                return
                }

                //Access the Date object from the event object.        
                brokerAddEventDate=eventObj.currentTarget.selectedDate.getDate();
                brokerAddEventMonth=eventObj.currentTarget.selectedDate.getMonth();
                brokerAddEventYear=eventObj.currentTarget.selectedDate.getFullYear();
               
            }

Then, when I'm creating an Event, I include the following (startTimePassHourBroker and startTimePassMinuteBroker are what I'm ussing to pass the hour and minute):
evtBroker.ActivityDateTime = new Date(brokerAddEventYear, brokerAddEventMonth, brokerAddEventDate, startTimePassHourBroker, startTimePassMinuteBroker, 0);