Questions tagged [angular-date-format]

48 questions
11
votes
2 answers

Angular - Get the format, as string, used to display dates according to locale

How can I get the format, as a string, used by Angular to display dates ? I use the date pipe after setting LOCALE_ID in my app.module. Now I'd like to retrieve the "dd/mm/yyyy" string, to put in my input placeholders. Basically, what's described…
Valentin Coudert
  • 1,759
  • 3
  • 19
  • 44
9
votes
4 answers

Angular 5 - how to make the period field type lowercase in DatePipe

Using DatePipe in Angular 5.1, I need to format the period field type (AM/PM) in lowercase. According to the documentation, Tuesday, December 19, 7:00 am should be date:'EEEE, MMMM d, h:mm a' However, the period field type always displays in…
ebakunin
  • 3,621
  • 7
  • 30
  • 49
7
votes
4 answers

Angular 8 way to convert json response with string dates to JS date?

I know that json does not treat dates in a special way and provides them as strings from the server. Is there a way to provide a json object response that has an ISO date property and map this to a class already with the date property mapped as a JS…
Philippe Gioseffi
  • 1,488
  • 3
  • 24
  • 41
6
votes
1 answer

How to convert Date in angular to another time zone

I am using Date() to get the current time in local time zone. And I have formatted that as follows: this.today = new Date(); from = new DatePipe('en-Us').transform(this.today, 'dd:MM:yyyy hh-mm-ss'); Now I want to convert the from date time…
Anil
  • 1,748
  • 8
  • 32
  • 67
5
votes
0 answers

Angular custom date format adapted to locale

I need to display dates based on locale. All goes well when I use the predefined formats (https://angular.io/api/common/DatePipe#pre-defined-format-options) import { formatDate } from '@angular/common'; ... //if `format` is one from the predefined…
bokkie
  • 1,477
  • 4
  • 21
  • 40
3
votes
4 answers

angular 2 date pipe weeknumber

I looked up how to return the week number in Angular 2. I have not found an answer to this question. I did find on https://docs.angularjs.org/api/ng/filter/date that in Angular 1 it would be something like this: {{today | date:'w'}} but this does…
JanVanHaudt
  • 253
  • 1
  • 6
  • 16
2
votes
0 answers

Angular displaying date with async data through datePipe

I'm finally able to display all my async data through this tutorial: https://coryrylan.com/blog/using-angular-forms-with-async-data The only existing problem is that I collect all the data from my Postgres database and the Dates are saved or arrive…
CptDayDreamer
  • 1,526
  • 6
  • 25
  • 61
2
votes
3 answers

How to format dateFormat in [ngModel] in angular 2?

How to format date like dd-MM-YYYY in [ngModel] ?
user11123760
2
votes
4 answers

How do I convert '2019-02-22T12:11:00Z' to 'DD/MM/YYYY HH:MM:SS' format in angular

I am working on some API clockify API integration. I am getting all time entries from the API. in the response I am getting start & end time of the task in the 2019-02-22T12:11:00Z. I want to convert above date format in DD/MM/YYYY HH:MM:SS format.…
lakhan
  • 255
  • 7
  • 14
2
votes
1 answer

Format date in Angular based on Timezone

I'm receiving dates from my API that are in UTC format. I need to output the dates using the user's local timezone. Each user is assigned a timezone that I pull from a different API. Using the following documentation I was able to make things work…
Kyle Barnes
  • 729
  • 3
  • 13
  • 22
2
votes
1 answer
1
vote
1 answer

Angular: input type="date" with initial value

I have two inputs type="date" to filter the data by period. I would like to bring them with value already informed when loading the page. First input with value Date() -7. Second input with Date(). This is my angular code:
1
vote
1 answer

Angular Date Formatting add the 'at' before time

Is there simple way to add the word 'at' in between my date and time so it reads like this: Jan 20, 2015 at 11:49 AM, instead of Jan 20, 2015, 11:49 AM. I tried long and full but I do not want the seconds and locale showing. 2015-01-20…
Flash
  • 924
  • 3
  • 22
  • 44
1
vote
0 answers

Angular DatePipe transform while patching values

While patching the values in a reactive form, the date type isn't displaying the value since the datePipe transform isn't working for that field. component.ts initX() { return this.fb.group({ 'date': [''], 'nodes': this.fb.array([ …
1
vote
1 answer

Convert custom string into Angular Date

I have a string like "August 24th, 2020" that I need to convert into the "Date" type in Angular. Is there any simple way to do this please? I've tried this: const deadline = new Date ("August 24th, 2020") But that results in "Invalid Date".
1
2 3 4