Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create a Date object for the start date (August 7, 2024)
- let startDate = new Date('2024-08-07');
- // Get today's date
- let today = new Date();
- // Calculate the difference in time (in milliseconds)
- let timeDifference = today - startDate;
- // Convert the time difference from milliseconds to days
- let daysSince = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
- // Create the widget
- let widget = new ListWidget();
- // Set the background gradient
- let gradient = new LinearGradient();
- gradient.colors = [new Color("#1e3c72"), new Color("#2a5298")]; // Blue gradient
- gradient.locations = [0.0, 1.0];
- widget.backgroundGradient = gradient;
- // Add a title
- let title = widget.addText("Days Since uConsole Order");
- title.font = Font.boldSystemFont(16);
- title.textColor = new Color("#ffffff"); // White text for contrast
- title.centerAlignText();
- // Add the start date
- let date = widget.addText("Order number: - Aug 7, 2024");
- date.font = Font.regularSystemFont(14);
- date.textColor = new Color("#dcdcdc"); // Light gray for the date
- date.centerAlignText();
- // Add the days since count
- let count = widget.addText(`${daysSince} Days`);
- count.font = Font.boldSystemFont(40);
- count.textColor = new Color("#00ff7f"); // Soft green for emphasis
- count.centerAlignText();
- // Display the widget
- if (config.runsInWidget) {
- Script.setWidget(widget);
- } else {
- widget.presentMedium();
- }
- Script.complete();
Advertisement
Add Comment
Please, Sign In to add comment