Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple dates selection #27

Open
pvni opened this issue Jul 4, 2016 · 1 comment
Open

Multiple dates selection #27

pvni opened this issue Jul 4, 2016 · 1 comment

Comments

@pvni
Copy link

pvni commented Jul 4, 2016

How can i achieve multiple dates selection in this API.
My requirement is when user selects two dates then i have to change the date cells color in b/w these 2 selected dates.
can i achieve my requirement using this API.

@MinteFino
Copy link

#include <stdio.h>

#define NUM_DATES 31 // Assuming 31 date cells

int main() {
int selectedDates[NUM_DATES] = {0}; // Initialize an array to track selected dates
int startDate, endDate;

// Simulate user selecting two dates (for example, 5th and 15th)
startDate = 5;
endDate = 15;

// Mark selected dates in the array
for (int i = startDate; i <= endDate; i++) {
    selectedDates[i] = 1;
}

// Display date cells and change colors based on selection
for (int i = 1; i <= NUM_DATES; i++) {
    if (selectedDates[i] == 1) {
        printf("\x1b[31m"); // Change text color to red (you can customize this)
    }

    printf("%2d ", i);

    if (selectedDates[i] == 1) {
        printf("\x1b[0m"); // Reset text color to default
    }
}

return 0;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants