Adaptive Card Date Format dd/MM/yyyy - adaptive-cards

I'm trying to format an Adaptive card date to dd/MM/yyyy
using this data:
{
"Due_Date": "2020-09-20T06:08:00Z",
}
I tried these formats:
{
"type": "TextBlock",
"text": "Due Date: {{DATE(${$root.Due_Date}, COMPACT)}} "
},
{
"type": "TextBlock",
"text": "Due Date: ${formatDateTime(Due_Date, 'dd/MM/yyyy')}"
}
and I got this render from AC Studio:
When I use the designer I get this result:
Using:
{
"title": "Date Only",
"value": "{{DATE(${start}, COMPACT)}}"
},
This is the problem I am having with my card rendering as MM/dd/yyyy.
So AC Viewer is using my locale but the browser is using some other locale.
Even more interesting look at the time. that time has had 12 hours added on to it!
I'd like to tell this card that to use my locale, can I configure the SDK to use my locale. Why is the browser not using my locale?
Using AC Studio My locale is EN-AU , I don't think it's using it at all :-(
Rendered using Javascript SDK and AC Studio in VS Code, same in AC Designer
TIA. all suggestions welcome

There's various ways to format dates on AdaptiveCards when using Adaptive Expressions.
There's a nice sample card here: https://www.madewithcards.io/cards/adaptive-expressions-playing-with-dates
[{
"title": "Date Only",
"value": "${formatDateTime(start, 'yyyy-MM-dd')}"
}, {
"title": "Time Only",
"value": "${formatDateTime(start, 'HH:mm')}"
}, {
"title": "Date and Time",
"value": "${formatDateTime(start, 'dd.MM.yyyy HH:mm')}"
}, {
"title": "Long Date",
"value": "${formatDateTime(start, 'dddd dd. MMMM yyyy')}"
}, {
"title": "Short Date",
"value": "${formatDateTime(start, 'MM MMMM y')}"
}, {
"title": "Short Date with Time",
"value": "${formatDateTime(start, 'dd.MM.yy - hh:mm')}"
}]

I have submitted this as an Issue for the Javascript SDK https://github.com/microsoft/AdaptiveCards/issues/4842

Related

Custom Approval ActionIdType AWS

I am trying to build a custom approval step for my CodePipeline on AWS. The AWS built default approval ActionTypeId does not let you output artifacts. I want my approval step to be able to output artifacts. I found this document on creating custom ActionTypeIds but I am still confused an fuzzy on this. Any help will be really appreciated.
I've posted the code from AWS. can someone help me understand the "settings" and the "configurationProperties" sections?
{
"category": "Approval",
"provider": "My-Custom-ActionIdType",
"version": "1",
"settings": {
"entityUrlTemplate": "https://my-build-instance/job/{Config:CGBoyProject}/",
"executionUrlTemplate": "https://my-build-instance/job/{Config:ProjectName}/lastSuccessfulBuild/{ExternalExecutionId}/"
},
"configurationProperties": [{
"name": "ProjectName",
"required": true,
"key": true,
"secret": false,
"queryable": false,
"description": "The name of the build project must be provided when this action is added to the pipeline.",
"type": "String"
}],
"inputArtifactDetails": {
"maximumCount": integer,
"minimumCount": integer
},
"outputArtifactDetails": {
"maximumCount": integer,
"minimumCount": integer
},
"tags": [{
"key": "Project",
"value": "ProjectA"
}]
}

'Add theme settings for configuration' in shopify - Error message 'unexpected token' keeps coming up?

I'm following instructions on shopify developers to create a 'How did you hear about us form field' for my website. FYI I am using safari on a Mac. Everything was working fine until I got to the step of 'Add theme settings for configuration.' In the Config. directory of settings_schema-json, the current code (below) already exists:
[
{
"name": "theme_info",
"theme_name": "Themekit template theme",
"theme_version": "1.0.0",
"theme_author": "Shopify",
"theme_documentation_url": "https:\/\/github.com\/Shopify\/themekit",
"theme_support_url": "https:\/\/github.com\/Shopify\/themekit\/issues"
}
]
I'm trying to add to that code with the code pasted below from shopify developers, which I'm told to paste on a new line below the closing curly bracket (above). But each time I do that and hit save, two error messages come up (see attached screenshot at bottom of post). The messages read 'An error prevented settings_schema.json from being saved' and 'Invalid JSON: unexpected token.' Does anybody have any idea what's going wrong here? I would be very grateful as I'm brand new to coding and this is the first time I've tried to make any changes to my website!
Thanks, Cosmo.
{
"name": "Hear About Us",
"settings": [
{
"type": "text",
"id": "hau_form_options",
"label": "Form options",
"default": "Facebook, Twitter, Google, Instagram, Youtube",
"info": "Separate each option with a comma"
},
{
"type": "header",
"content": "Form validation"
},
{
"type": "checkbox",
"id": "hau_form_validation",
"label": "Enable form validation",
"default": true
},
{
"type": "text",
"id": "hau_error_message",
"label": "Error message",
"info": "The error message that is displayed when no selection is made",
"default": "Please select an option below"
},
{
"type": "text",
"id": "hau_error_message_other",
"label": "Other field error message",
"info": "The error message that is displayed when there is no input in the 'Other' field",
"default": "Please fill the text field below"
},
{
"type": "header",
"content": "Error styling"
},
{
"type": "color",
"id": "hau_error_color",
"label": "Color",
"default": "#ff0000"
}
]
},
screenshot error message
Missing a comma ,, correct it and works fine
Update:

How do you make Vega-Lite calculations with a field that has a space in its name?

I'm trying to do a calculation in Vega-Lite and the data I'm working with has spaces in its field header names. To provide a sample of some of the data I'm working with, see below:
"data": {
"values": [
{
"Event Classification": "Online",
"Time Period": "Last Week",
"Status": "Activity",
"Events": "100",
"Total Events": "500",
},
{
"Event Classification": "In Person",
"Time Period": "Last Week",
"Status": "No Activity",
"Events": "400",
"Total Events": "500",
}
And in a transform object I am writing code to divide Events by Total Events. However, I am not able to get the below code working:
"transform": [
{
"calculate": "datum.Events/datum.Total Events",
"as": "Percent of Events"
}
I am getting the error Unexpect token after expression. when I am doing this in the Vega Editor. I cannot change the column headers because this data is coming out of an enterprise-wide database. Here is the link to the editor for someone to check out the problem I am running into. Thanks so much for your help!
Use bracket notation:
"calculate": "datum.Events/datum['Total Events']",

Require Input.Toggle's to be Checked True Before Submitting?

I have the following adaptive card JSON code that has three Input.Toggle's. Is there a way to throw an error when the user clicks "Submit" and all three Input.Toggle's are not set to true? I saw in the Schema Explorer (Schema Explorer Input.Toggle) that they have Inherited properties called "fallback" and "requires", is that what I need? If so, how do I implement "fallback" and "requires" into this JSON code?
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"placeholder": "1.1 Business Office Coordinator - RFQ Receipt",
"type": "Input.Text",
"id": "Title"
},
{
"text": "Quote ##{body('Get_response_details')?['b194cde8837234ccc80fu5017c1b0f869']} ",
"type": "TextBlock",
"id": "textBlock1"
},
{
"type": "Input.Toggle",
"title": "Customer Acknowledgement",
"valueOn": "custYes",
"valueOff": "custNo",
"id": "Customer"
},
{
"type": "Input.Toggle",
"title": "Create RFQ Log Number and Enter Information into RFQ Log",
"valueOn": "RFQYes",
"valueOff": "RFQNo",
"id": "RFQ"
},
{
"type": "Input.Toggle",
"title": "Populate Quote Folder with Customer Data",
"valueOn": "PopulateYes",
"valueOff": "PopulateNo",
"id": "Populate"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"data": {
"id": "9876543210"
}
}
]
}
this is part of input validation which as of today is not available yet.
I'm afraid what you're asking for is not possible right now but will hopefully be soon.
You can follow the feature request here: https://portal.productboard.com/adaptivecards/1-adaptive-cards-features/c/21-input-validation-and-evolution , add your own vote to it aswell if you want to.
Depending on where you use the card however, you can get this working. In MS Teams you could verify the card submission in your own code and return an error. Its not client side but that way you can still do the check.

How do I test for Google Calendar events that are marked: "Automatically decline new and existing meetings"

Non-engineer here. I'm working on a program (using Google Sheets) that will help people in my office analyze their calendars.
The Google Calendar Service has methods that allow me to retrieve event start and end times, guest lists, and much more. Unfortunately, I haven't figured out how to tell the difference between a "Reminder" and an "Out of the office" event. They both show up as all day events, but the former can be ignored and the latter causes that entire day to show up as "blocked" or "scheduled". I need to be able to tell them apart, but I'm not sure how.
Any suggestions?
MORE DETAIL:
I create a "Reminder" in Google Calendar by clicking just below the day, at the top. This gives me three choices: Event, Out of the office, and Appointment slots. When I am creating a Reminder for myself I first name it (i.e. "Doctor's appointment at 2:00"), then I usually change the color to red so it's extra visible.
If I am going to be Out of the office I choose that option. The option "Automatically decline new and existing meetings" is checked by default. I add a name like, "Dev Conference" and Save it. This causes the entire day to show in a light blue color, indicating that the entire day is blocked.
You can differentiate between a normal event and a "Out of Office" event because of the latter not having the transparency attribute included and it has the description attribute filled with the following value:
"This is an out-of-office event, which can only be edited in Google Calendar. Meetings during this time will be automatically declined."
You can test this by making a Events.list request and check the results, for example:
Normal event:
{
"kind": "calendar#event",
"etag": "\"3167876463844000\"",
"id": "1nqq8sg43po8itr8h0ebedfgbq",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MW5xcThzZzQzcG84aXRyOGgwZWJlZGZnYnEgdGVzdGluYUBlZ3Mtc2J0MDExLmV1",
"created": "2020-03-11T14:50:31.000Z",
"updated": "2020-03-11T14:50:31.922Z",
"summary": "test",
"creator": {
"email": "testina#egs-sbt011.eu",
"self": true
},
"organizer": {
"email": "testina#egs-sbt011.eu",
"self": true
},
"start": {
"date": "2020-03-16"
},
"end": {
"date": "2020-03-17"
},
"transparency": "transparent",
"iCalUID": "1nqq8sg43po8itr8h0ebedfgbq#google.com",
"sequence": 0,
"reminders": {
"useDefault": false
}
}
Out of Office event:
{
"kind": "calendar#event",
"etag": "\"3167876472386000\"",
"id": "29g3lpl9hojb92bevvkvdccq6p",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MjlnM2xwbDlob2piOTJiZXZ2a3ZkY2NxNnAgdGVzdGluYUBlZ3Mtc2J0MDExLmV1",
"created": "2020-03-11T14:50:36.000Z",
"updated": "2020-03-11T14:50:36.289Z",
"summary": "test OOO",
"description": "This is an out-of-office event, which can only be edited in Google Calendar. Meetings during this time will be automatically declined.",
"creator": {
"email": "testina#egs-sbt011.eu",
"self": true
},
"organizer": {
"email": "testina#egs-sbt011.eu",
"self": true
},
"start": {
"dateTime": "2020-03-17T00:00:00+01:00"
},
"end": {
"dateTime": "2020-03-18T00:00:00+01:00"
},
"visibility": "public",
"iCalUID": "29g3lpl9hojb92bevvkvdccq6p#google.com",
"sequence": 0,
"reminders": {
"useDefault": false
}
}
Regarding appointment slots, these are not supported by Google Calendar API, you can +1 this open feature request to implement this.
For a while after the feature was introduced, there was no way to filter them via API other than parsing the description. There is now an eventType key on events.
https://developers.google.com/calendar/api/v3/reference/events#eventType
Look for "eventType": "outOfOffice" events.