Steadyspaghetti

Untitled

Aug 23rd, 2024 (edited)
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. // Create a Date object for the start date (August 7, 2024)
  2. let startDate = new Date('2024-08-07');
  3.  
  4. // Get today's date
  5. let today = new Date();
  6.  
  7. // Calculate the difference in time (in milliseconds)
  8. let timeDifference = today - startDate;
  9.  
  10. // Convert the time difference from milliseconds to days
  11. let daysSince = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
  12.  
  13. // Create the widget
  14. let widget = new ListWidget();
  15.  
  16. // Set the background gradient
  17. let gradient = new LinearGradient();
  18. gradient.colors = [new Color("#1e3c72"), new Color("#2a5298")]; // Blue gradient
  19. gradient.locations = [0.0, 1.0];
  20. widget.backgroundGradient = gradient;
  21.  
  22. // Add a title
  23. let title = widget.addText("Days Since uConsole Order");
  24. title.font = Font.boldSystemFont(16);
  25. title.textColor = new Color("#ffffff"); // White text for contrast
  26. title.centerAlignText();
  27.  
  28. // Add the start date
  29. let date = widget.addText("Order number: - Aug 7, 2024");
  30. date.font = Font.regularSystemFont(14);
  31. date.textColor = new Color("#dcdcdc"); // Light gray for the date
  32. date.centerAlignText();
  33.  
  34. // Add the days since count
  35. let count = widget.addText(`${daysSince} Days`);
  36. count.font = Font.boldSystemFont(40);
  37. count.textColor = new Color("#00ff7f"); // Soft green for emphasis
  38. count.centerAlignText();
  39.  
  40. // Display the widget
  41. if (config.runsInWidget) {
  42. Script.setWidget(widget);
  43. } else {
  44. widget.presentMedium();
  45. }
  46.  
  47. Script.complete();
Advertisement
Add Comment
Please, Sign In to add comment