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
prasanth puvvada 4prasanth puvvada 4 

problem with simple if statement in aura component.

I want to display the todays date . so i created this component and insetedinto the aura:application.  at loading this page i am getting this error.

Error during init : Unable to find 'checkWeekday' on 'compound://c.MOTD1'.​
<aura:component implements="force:appHostable">
    <aura:attribute name="{!v.dayofweek}" type="string" default=""/>
    <aura:handler name="init" value="{!this}" action="{!c.callday}" />
    
    <aura:if isTrue="{!v.dayofweek == 'sunday' }" >
    <b>This is {!v.dayofweek} </b>
    </aura:if>
    
    <aura:if isTrue="{!v.dayofweek == 'monday'}" >
    <b>This is {!v.dayofweek} </b>
    </aura:if>
    
    <aura:if isTrue="{!v.dayofweek == 'tuesday' }">
    <b>This is {!.dayofweek} </b>
    </aura:if>
    
    <aura:if isTrue="{!v.dayofweek == 'weds' }" >
    <b> This is {!v.dayofweek} </b>
    </aura:if>
    
	
</aura:component>
 
({
	checkday : function(component) {
		var d= new Date();
        var weekday=new Array(7);
        weekday[0]= "sunday";
        weekday[1]="monday";
        weekday[2]="tuesday";
        weekday[3]="wednesday";
        
        var n=weekday[d.getday()];
        component.set("v.dayofweek",n);
	}
   
})

 
Krishna SambarajuKrishna Sambaraju
In your component the handler "init" is calling an action "c.callday", but the function you created is "checkday". Change the function to "callday" and check it.