Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. //Aqui capturo la fecha, esta puesta la variable como Date
  2. private recogerFecha(value: Date) {
  3. this.setState({
  4. FechaBriefCampanya: value
  5. });
  6.  
  7. }
  8.  
  9. //Método por el que filtro
  10. private async getCampaign(): Promise<any[]> {
  11.  
  12. let cadFechaInicio = "<Leq><FieldRef Name='CampoFechaInicio' /><Value Type='DateTime'>" + this.state.FechaInicio.toISOString().split('T')[0] + "</Value></Leq>";
  13. let cadFechaFin = "<Geq><FieldRef Name='CampoFechaFin' /><Value Type='DateTime'>" + this.state.FechaFin.toISOString().split('T')[0] + "</Value></Geq>";
  14.  
  15.  
  16. console.log(cadFechaInicio);
  17. console.log(cadFechaFin);
  18.  
  19. let listItems = await sp.web.lists.getByTitle('NombreLista').getItemsByCAMLQuery(
  20. {
  21. ViewXml:
  22. "<View><Query><Where>" + cadFechaInicio + cadFechaFin + "</Where></Query></View>"
  23. }
  24. );
  25. console.log(listItems);
  26. }
  27.  
  28. <DatePicker firstDayOfWeek={DayOfWeek.Monday} strings={DayPickerStrings} showWeekNumbers={false} firstWeekOfYear={1} showMonthPickerAsOverlay={true}
  29. value={this.state.FechaBriefCampanya} onSelectDate={this.recogerFecha} formatDate={this._onFormatDate} />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement