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

feat: dateTime marketplace tool #861

Conversation

yavisht
Copy link
Contributor

@yavisht yavisht commented Sep 1, 2023

The function

// Define the desired time zone
const timeZone = 'Australia/Sydney';

// Define an options object to format the date and time
const options = {
    timeZone: timeZone,   // Set the time zone
    year: 'numeric',       // Display the year as a number
    month: 'long',         // Display the full month name
    day: 'numeric',        // Display the day of the month as a number
    weekday: 'long',      // Display the full weekday name
    hour: '2-digit',       // Display the hour in 2-digit format (00-23)
    minute: '2-digit',     // Display the minute in 2-digit format (00-59)
    second: '2-digit',     // Display the second in 2-digit format (00-59)
    hour12: true           // Use 12-hour time format (AM/PM)
};

// Create a new Date object representing the current date and time
const today = new Date();

// Format the current date and time according to the options and locale 'en-GB'
const formattedDate = today.toLocaleString('en-GB', options);

// Create a result object containing the formatted date and the time zone
const result = {
    "formattedDate": formattedDate, // Store the formatted date and time
    "timezone": timeZone           // Store the specified time zone
};

// Return the result object as a JSON string
return JSON.stringify(result);

Set it up with a function agent:

Screenshot 2023-09-01 at 9 14 10 am

Results:

Screenshot 2023-09-01 at 9 15 05 am

@HenryHengZJ
Copy link
Contributor

thank you @yavisht !

@HenryHengZJ HenryHengZJ merged commit 238db00 into FlowiseAI:main Sep 1, 2023
@yavisht yavisht deleted the feature/add-date-time-tool-for-marketplace branch September 1, 2023 11:36
hemati pushed a commit to hemati/Flowise that referenced this pull request Dec 27, 2023
…ool-for-marketplace

feat: dateTime marketplace tool
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

Successfully merging this pull request may close these issues.

2 participants