Skip to content

Instantly share code, notes, and snippets.

View danielhgasparin's full-sized avatar

Daniel Henrique Gasparin danielhgasparin

View GitHub Profile
@martinobordin
martinobordin / AngularRxJs5DateHttpInterceptor.ts
Last active September 22, 2023 08:23
An Angular interceptor to parse string dates (ISO8601 format) from server response to JS Date Object. There are both RxJs 5 and RxJs 6 versions
import { Injectable } from '@angular/core';
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/do';
@Injectable()
export class AngularDateHttpInterceptor implements HttpInterceptor {
// Migrated from AngularJS https://raw.githubusercontent.com/Ins87/angular-date-interceptor/master/src/angular-date-interceptor.js
iso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/;
@GavinRay97
GavinRay97 / file.ts
Created May 13, 2020 22:08
Vue 3 Composition API Typescript Component Props
import { defineComponent, computed, ref } from '@vue/composition-api'
interface User {
firstName: string
lastName: number
}
export default defineComponent({
props: {
user: {