From New Zealand the record could be created Friday but for Cooks Island the record can be Thursday entry.
This is where PHP Carbon date comes to uses and Javascript Moments.
Install Moment and format as required. In VueJS create a filter
import moment from 'moment';
import moment from 'moment';
import {VueConstructor} from 'vue';
export const filters = {
period: (value: string): string => {
if (!value) return '-';
return moment(value).format('MMM YYYY');
},
periodFullMonth: (value: string): string => {
if (!value) return '-';
return moment(value).format('MMMM YYYY');
},
date: (value: string): string => {
if (!value) return '-';
return moment.utc(value).local().format('DD-MM-YYYY');
},
absoluteDate: (value: string): string => {
if (!value) return null;
return moment(value).format('DD-MM-YYYY');
},
};
export const createFilters = (vue: VueConstructor) => {
vue.filter('period', filters.period);
vue.filter('date', filters.date);
vue.filter('absoluteDate', filters.absoluteDate);
vue.filter('periodFullMonth', filters.periodFullMonth);
};
export default filters;
You might need to format the fields requests when saving
Model::create([
'began_at' => Carbon::createFromFormat('d-m-Y', $request->get('began_at')),
'terminated_at' => $request->get('terminated_at'),
]);
Database Migration Scripts
$table->dateTime('created_at');
$table->date('birthdate');
This comment has been removed by a blog administrator.
ReplyDeleteI was nervous when I Clicked on this on this blog I felt what im looking for this blogs haves but thank you to the author who has everything in this blog for what im looking for. This blog writer has the best knowledge about laravel.
ReplyDeleteIf you're looking for Laravel Web Development Services in India so, you can visit our CodeKing Solutions for the best offers.