Mandrill Handlebars Template Date Formatting - handlebars.js

So, I'm working on a template where I have a merge variable, dateSubmitted. This variable comes from an API where it's formatted as so:
dateSubmitted = 2017-09-13GMT22:25:45.513+00:00
I'm trying to insert this date in a slightly nicer way into an email, so in my Mandrill template (using Handlebars) I'm doing the following:
<li><em>Date Submitted:</em> {{date dateSubmitted}}</li>
However, my date continues to display in the email as 2017-09-13GMT22:25:45.513+00:00. What am I doing wrong?

Stumble upon this too. After an hour I re-read the docs, where is stated, that this inline helper is used to
print the current date with a given format, defaults to d/m/Y
So, it is not for formatting your variables but for just displaying current date in custom format.

Related

How to change date format in Email Template of Dynamics365?

I want to get the date in this format -
MM-dd-yy.
For example: 10-12-23
I'm writing this code but don't getting the desired solution -
{<entity_name>:<attribute>/#date;} Check-In Link
What should I write in the date part?
I'm afraid the only way to make it work is to set the user's locale to a locale that uses MM-dd-yy format.
Alternatively, it's possible to create a custom string field, populate that field with a properly formatted date and use the value of it in your template.

Can't Format Date in GraphQL in Gatsby Site

I am having trouble formatting a date in Gatsby. I have sourced some data from firestore. One of the fields that I have sourced is called datePublished and it contains a number in the form of a timestamp (e.g., 1576945502000). Indeed, it really is a timestamp, but it got saved to firestore in the number format type.
Now, I would like to format the datePublished field using the formatString function in graphql -- as noted here: https://www.gatsbyjs.org/docs/graphql-reference/#dates
But I can't get the formatting to work. Whether I try to format the string in graphiql or on my site, it does not work. Here is the code that I tried:
query MyQuery {
allNewsFeed {
edges {
node {
published(formatString:"dddd Mo, YYYY")
}
}
}
}
And this is the error message that I get in graphiql:
Unknown argument "formatString on field 'datePublished' of type 'NewsFeed'.
If I dig a little deeper, I notice that the field type in firestore is listed as number and in the graphiql document explorer it is listed as a FloatQueryOperatorInput.
What's more, I did a little experiment where I tried to save the same number as a string, number and timestamp in firestore. Neither the string or number format worked and for whatever reason, the gatsby-firesource plugin will not pull in the field with a timestamp format.
So I am wondering, what do I have to do to get this to work in gatsby?
Any ideas?
Thanks.
I had a similar situation with Gatsby not accepting "formatString" on a date field, for me what solved the issue was to change the format of the field to YYYY-MM-DD so it went from 02 06 2017 to 2017-06-02 and gatsby got the hint that that field represents a date.
It seems gatsby "reads" the data and guesses the type and based on that we get certain functionality.
Since gatsby uses moment.js I'm guessing the YYYY-MM-DD format is picked up by it.
I'm using MDX so it was really easy for me to change the format of my date field since it's just plain text, I'm not sure you have the same luxury with firestore but I hope this at least give you some ideas to try out. Good luck!

Google Docs Forms - need Pre-fill Date & Time Entry with current date and current time

Google Forms I need Pre-filled current Date & current Time Entry in date and time fields of my google form. How to do it
My solution is to make the Date field optional. The default is to assume the todays date which is what you get from the timestamp field. In case it needs to be anything else you can enter it manually.
A simple code-free solution is to make separate sections in your form and use the feature that routes users to different sections based on responses. The first section asks whether the form is for the current date/time. If yes, you use the timestamp as the date and time and route the user to the main section with your questions. If not, route them to a section to set the date and time, and then after that route them to the main section.
2023 Solution
-Google Forms has updated how dates are passed through URL parameters.
Instead of passing each component of a date as a separate param, you now pass them using the same syntax as all other fields using the YYYY-MM-DD format for your date value.
Here is an example URL:
`https://docs.google.com/forms/d/e/${formId}/viewform?usp=pp_url&entry.${dateEntryFieldID}=${YEAR}-${MONTH}-${DAY}`

Symfony 2.1. How can I display a single_text time field in 12 hour am/pm format?

I have a time field on my form with widget set to 'single_text'.
My US users will want 12 hour am/pm format.
http://symfony.com/doc/current/reference/forms/types/time.html#widget
Although it's not entirely obvious, that accepts an input of 2:15pm but if the form returns because of a validation error on another field or is later opened to edit an existing record then it displays 14:15 which of course is correct but is probably off-putting.
How do I get it to display 2:15pm? I don't see an option to do that.
Well, this turns out to be harder than it should be. The problem is that the Time form type does not allow you to specify a format like the Date form type does and the format it uses is H:i. Yes, 24-hour format :-(
So, the only solution is to build your own form type which uses the h:i format. You can find instructions for how to build your own form type here:
http://symfony.com/doc/2.1/cookbook/form/create_custom_field_type.html
Then you can use the Time form type as the base for your form type and just change the format it uses. The Time form type can be found here:
/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Control input of SQLite attribute to date format only.

I have been reading all about converting TEXT fields into date formats and ways to use Python to create date objects but my question remains.
My table has a dateTime column that is specified as TEXT, I would like to build a constraint that forces input to be in dateTime format, but as SQLite doesn't do dates (as I would like) I haven't worked out how to do it.
My current ideas: 1. Limit number of characters
2. Set separate attributes for day, month and year and constrain their domains
3. It is silly to do this on the database side just do it in the user interface
I would appreciate your opinions on these or other options.
Thanks :)
I've been trying to solve the same issue and the method I came up with was to use the date/time functions to parse the value and check that it hasn't changed. Essentially the following:
CREATE TABLE dts_test (
dts TEXT CHECK (dts IS datetime(dts))
);
If the default format is not what you want you can use the strftime or similar to design whatever format you want, but it must be something that the built-in date and time functions can parse.

Resources