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
Alpana RawatAlpana Rawat 

In LWC , I have a requirement to show a warning tool tip if date is less than 30 days. I am done with days calculation part , but I am confused how to show the tool tip in UI.please help me, how to implement that in LWC

In LWC , I have a requirement to show a warning tool tip if  date is less than 30 days.
I am done with days calculation part , but I am confused how to show the tool tip in UI.
but how to implement this in LWC. please help me, how to implement that in LWC html file. 

below is the code for days calculation in js file.
 

i have data, based on expiration date, I want to show the tooltip

 let dt = new Date( dataParse.Expiration_Date__c );
                    dataParse.Expiration_Date__c = new Intl.DateTimeFormat( 'en-US' ).format( dt );
                    let  today = new Date();
                    let daysRem =   dt - today ;
                    let daysDiff = Math.round(daysRem / (1000 * 3600 * 24 ));
                   console.log( 'date format=='+ dt);
                   console.log('today date==' + today);
                   console.log( 'remaining days=='+ daysRem);
                   
                  if(daysDiff <= 30)
                  {
                   //we can write logic here to show the tooltip (as per my understanding)  
                  }
                  else
                  {
                    //we can write logic here to show the tooltip (as per my understanding)  
                  }
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Alpana,

I hope you got the solution for this. If not can you explore the similar way for the LWC as well.

https://developer.salesforce.com/docs/component-library/bundle/lightning-helptext/example

If this solution helps, please mark it as best answer.

Thanks,