How To Customize Angular Date Filter - javascript

How To Customize Angular Date Filter in Thai Format or Another Country format?
17 March 2017 or 2017-03-17 change to 17 {Thai Month} 2560

Related

How can I convert a date to DatePicker value format in ExtJS?

I want to convert "22.11.2022 00:00:00" to Mon Nov 21 2022 00:00:00 GMT+0300 (GMT+03:00) and set picker value.
My code:
view.picker.setValue(this.jsonData.dateData)
I tried
console.log(Ext.Date.format(dt, 'l, \\t\\he jS \\of F Y h:i:s A')); // Wednesday, the 10th of January 2007 03:05:01 PM
but it didn't work.
How can I do this?
Because this question is related to ExtJS, i would suggest the following
Ext.Date.parse('22.11.2022 00:00:00', 'd.m.Y H:i:s')
docs:
https://docs.sencha.com/extjs/6.5.3/classic/Ext.Date.html
The main problem here is that the datepicker expects a JavaScript Date as it's value. You could easily achieve that by creating a new JavaScript Date using new Date(this.jsonData.dateData). Since you are getting a german Date/String represenation this would still not work.
If you change to the correct formatting you should get a valid Date Object that you can set to the picker.
const dateString = "22.11.2022 00:00:00",
dateObject = new Date(dateString.replace(/(.*)\.(.*)\.(.*)/, '$2-$1-$3'));
picker.setValue(dateObject);
Here is a working example: sencha fiddle

how to convert UTC time to specified format in momentjs in ember helper

i am working in ember with moment js. this below code convert my local time to UTC format
{{ utc (moment timeEntry 'YYYY-MM-DD HH:mm:ssZ')}}
and output is like Tue Nov 26 2019 00:00:00 GMT+0000.
But i want to display the output like Tue, 26 Nov, 2019.
i tried moment-format for utc time but no luck
The YYYY-MM-DD HH:mm:ssZ part of the code is what determines the output. You can read up on the other possible outputs here.
To get your desired output of Tue, 26 Nov, 2019, you should use {{ utc (moment timeEntry 'ddd, D MMM, YYYY')}}}

date of birth search validation angularjs

while searching date of birth in frontend( angularjs) the request is going with different date of birth to backend spring
i am sending date of birth in this format:
Sun Aug 15 1999 00:00:00 GMT+0530 (India Standard Time)
request url to backend:
dob=1999-08-14T18:30:00.000Z
You can convert date into the required format using the angular date filter, Have look here AngularJS date filter .
You might be looking for something like this: {{ date_expression | date : 'yyyy-MM-ddTHH:mm:ss.sssZ' : timezone}}

Convert date to datetime (and give it default time) in Javascript

I have an input in my React app that prompts user to select a date without time.
I am creating a scheduler that sends notification at specific time, say 7:00 PM, the night before. So if user selects 5/17/2017, I want it to send reminder at 7:00 PM 5/16/2017. I can do the math subtracting the day and hours, if they are both in datetime format. However, one data is in date format and another is in datetime.
The input I am using is simple input with type="date". The output looks like 2017-05-25. I tried adding .setHours(15) but it didn't work.
Is there a way to convert any given date to datetime and give them default time in Javascript? If I choose 2017-5-17 it will be converted to Wed May 17 2017 19:00:00 GMT-0700 (PDT)

How to get local hour from moment.js

I'm using moment.js to display differents date and times using
moment().format('llll');
It provide result like that in english
Tue, Oct 21, 2014 1:11 PM
and like that in french
mar. 21 oct. 2014 13:11
But I want to display only time (1:11PM or 13:11) and not the full date.
How can I do that ?
EDIT: The perfect thing would be to display seconds
1:11:15 pm and 13:11:15
To get only the localized time, in moment.js you have the 'LT' formatter:
moment().format('LT');
the result is the localized time :
1:11PM
Unfortunately, it seems that there are no formatters for localized time displaying seconds.

Categories