1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for DateFormat migration

This commit is contained in:
David Bomba 2021-02-23 19:58:41 +11:00
parent db0e684ff8
commit a41c15984b
2 changed files with 48 additions and 44 deletions

View File

@ -20,48 +20,52 @@ class AddTranslatedDateColumn extends Migration
//add multi DB support
$date_format = DateFormat::where('format', 'd/M/Y')->first();
$date_format->update(['translated_format' => '%d/%b/%Y']);
if(DateFormat::count() > 0 )
{
$date_format = DateFormat::where('format', 'd/M/Y')->first();
$date_format->update(['translated_format' => '%d/%b/%Y']);
$date_format = DateFormat::where('format', 'd-M-Y')->first();
$date_format->update(['translated_format' => '%d-%b-%Y']);
$date_format = DateFormat::where('format', 'd-M-Y')->first();
$date_format->update(['translated_format' => '%d-%b-%Y']);
$date_format = DateFormat::where('format', 'd/F/Y')->first();
$date_format->update(['translated_format' => '%d/%B/%Y']);
$date_format = DateFormat::where('format', 'd/F/Y')->first();
$date_format->update(['translated_format' => '%d/%B/%Y']);
$date_format = DateFormat::where('format', 'd-F-Y')->first();
$date_format->update(['translated_format' => '%d-%B-%Y']);
$date_format = DateFormat::where('format', 'd-F-Y')->first();
$date_format->update(['translated_format' => '%d-%B-%Y']);
$date_format = DateFormat::where('format', 'M j, Y')->first();
$date_format->update(['translated_format' => '%b %d, %Y']);
$date_format = DateFormat::where('format', 'M j, Y')->first();
$date_format->update(['translated_format' => '%b %d, %Y']);
$date_format = DateFormat::where('format', 'F j, Y')->first();
$date_format->update(['translated_format' => '%B %d, %Y']);
$date_format = DateFormat::where('format', 'F j, Y')->first();
$date_format->update(['translated_format' => '%B %d, %Y']);
$date_format = DateFormat::where('format', 'D M j, Y')->first();
$date_format->update(['translated_format' => '%a %b %d, %Y']);
$date_format = DateFormat::where('format', 'D M j, Y')->first();
$date_format->update(['translated_format' => '%a %b %d, %Y']);
$date_format = DateFormat::where('format', 'Y-m-d')->first();
$date_format->update(['translated_format' => '%Y-%m-%d']);
$date_format = DateFormat::where('format', 'Y-m-d')->first();
$date_format->update(['translated_format' => '%Y-%m-%d']);
$date_format = DateFormat::where('format', 'd-m-Y')->first();
$date_format->update(['translated_format' => '%d-%m-%Y']);
$date_format = DateFormat::where('format', 'd-m-Y')->first();
$date_format->update(['translated_format' => '%d-%m-%Y']);
$date_format = DateFormat::where('format', 'm/d/Y')->first();
$date_format->update(['translated_format' => '%m/%d/%Y']);
$date_format = DateFormat::where('format', 'm/d/Y')->first();
$date_format->update(['translated_format' => '%m/%d/%Y']);
$date_format = DateFormat::where('format', 'd.m.Y')->first();
$date_format->update(['translated_format' => '%d.%m.%Y']);
$date_format = DateFormat::where('format', 'd.m.Y')->first();
$date_format->update(['translated_format' => '%d.%m.%Y']);
$date_format = DateFormat::where('format', 'j. m. Y')->first();
$date_format->update(['translated_format' => '%d. %m. %Y']);
$date_format = DateFormat::where('format', 'j. m. Y')->first();
$date_format->update(['translated_format' => '%d. %m. %Y']);
$date_format = DateFormat::where('format', 'j. F Y')->first();
$date_format->update(['translated_format' => '%d. %B %Y']);
$date_format = DateFormat::where('format', 'd/m/Y')->first();
$date_format->update(['translated_format' => '%d/%m/%Y']);
$date_format = DateFormat::where('format', 'j. F Y')->first();
$date_format->update(['translated_format' => '%d. %B %Y']);
$date_format = DateFormat::where('format', 'd/m/Y')->first();
$date_format->update(['translated_format' => '%d/%m/%Y']);
}
}
/**

View File

@ -23,20 +23,20 @@ class DateFormatsSeeder extends Seeder
// Date formats
$formats = [
['id' => 1, 'format' => 'd/M/Y', 'format_moment' => 'DD/MMM/YYYY', 'format_dart' => 'dd/MMM/yyyy'],
['id' => 2, 'format' => 'd-M-Y', 'format_moment' => 'DD-MMM-YYYY', 'format_dart' => 'dd-MMM-yyyy'],
['id' => 3, 'format' => 'd/F/Y', 'format_moment' => 'DD/MMMM/YYYY', 'format_dart' => 'dd/MMMM/yyyy'],
['id' => 4, 'format' => 'd-F-Y', 'format_moment' => 'DD-MMMM-YYYY', 'format_dart' => 'dd-MMMM-yyyy'],
['id' => 5, 'format' => 'M j, Y', 'format_moment' => 'MMM D, YYYY', 'format_dart' => 'MMM d, yyyy'],
['id' => 6, 'format' => 'F j, Y', 'format_moment' => 'MMMM D, YYYY', 'format_dart' => 'MMMM d, yyyy'],
['id' => 7, 'format' => 'D M j, Y', 'format_moment' => 'ddd MMM Do, YYYY', 'format_dart' => 'EEE MMM d, yyyy'],
['id' => 8, 'format' => 'Y-m-d', 'format_moment' => 'YYYY-MM-DD', 'format_dart' => 'yyyy-MM-dd'],
['id' => 9, 'format' => 'd-m-Y', 'format_moment' => 'DD-MM-YYYY', 'format_dart' => 'dd-MM-yyyy'],
['id' => 10, 'format' => 'm/d/Y', 'format_moment' => 'MM/DD/YYYY', 'format_dart' => 'MM/dd/yyyy'],
['id' => 11, 'format' => 'd.m.Y', 'format_moment' => 'D.MM.YYYY', 'format_dart' => 'dd.MM.yyyy'],
['id' => 12, 'format' => 'j. M. Y', 'format_moment' => 'DD. MMM. YYYY', 'format_dart' => 'd. MMM. yyyy'],
['id' => 13, 'format' => 'j. F Y', 'format_moment' => 'DD. MMMM YYYY', 'format_dart' => 'd. MMMM yyyy'],
['id' => 14, 'format' => 'd/m/Y', 'format_moment' => 'DD/MM/YYY', 'format_dart' => 'dd/MM/yyyy'],
['id' => 1, 'format' => 'd/M/Y', 'format_moment' => 'DD/MMM/YYYY', 'format_dart' => 'dd/MMM/yyyy', 'translated_format' => '%d/%b/%Y'],
['id' => 2, 'format' => 'd-M-Y', 'format_moment' => 'DD-MMM-YYYY', 'format_dart' => 'dd-MMM-yyyy', 'translated_format' => '%d-%b-%Y'],
['id' => 3, 'format' => 'd/F/Y', 'format_moment' => 'DD/MMMM/YYYY', 'format_dart' => 'dd/MMMM/yyyy', 'translated_format' => '%d/%B/%Y'],
['id' => 4, 'format' => 'd-F-Y', 'format_moment' => 'DD-MMMM-YYYY', 'format_dart' => 'dd-MMMM-yyyy', 'translated_format' => '%d-%B-%Y'],
['id' => 5, 'format' => 'M j, Y', 'format_moment' => 'MMM D, YYYY', 'format_dart' => 'MMM d, yyyy', 'translated_format' => '%b %d, %Y'],
['id' => 6, 'format' => 'F j, Y', 'format_moment' => 'MMMM D, YYYY', 'format_dart' => 'MMMM d, yyyy', 'translated_format' => '%B %d, %Y'],
['id' => 7, 'format' => 'D M j, Y', 'format_moment' => 'ddd MMM Do, YYYY', 'format_dart' => 'EEE MMM d, yyyy', 'translated_format' => '%a %b %d, %Y'],
['id' => 8, 'format' => 'Y-m-d', 'format_moment' => 'YYYY-MM-DD', 'format_dart' => 'yyyy-MM-dd', 'translated_format' => '%Y-%m-%d'],
['id' => 9, 'format' => 'd-m-Y', 'format_moment' => 'DD-MM-YYYY', 'format_dart' => 'dd-MM-yyyy', 'translated_format' => '%d-%m-%Y'],
['id' => 10, 'format' => 'm/d/Y', 'format_moment' => 'MM/DD/YYYY', 'format_dart' => 'MM/dd/yyyy', 'translated_format' => '%m/%d/%Y'],
['id' => 11, 'format' => 'd.m.Y', 'format_moment' => 'D.MM.YYYY', 'format_dart' => 'dd.MM.yyyy', 'translated_format' => '%d.%m.%Y'],
['id' => 12, 'format' => 'j. M. Y', 'format_moment' => 'DD. MMM. YYYY', 'format_dart' => 'd. MMM. yyyy', 'translated_format' => '%d. %m. %Y'],
['id' => 13, 'format' => 'j. F Y', 'format_moment' => 'DD. MMMM YYYY', 'format_dart' => 'd. MMMM yyyy', 'translated_format' => '%d. %B %Y'],
['id' => 14, 'format' => 'd/m/Y', 'format_moment' => 'DD/MM/YYY', 'format_dart' => 'dd/MM/yyyy', 'translated_format' => '%d/%m/%Y'],
];
foreach ($formats as $format) {
@ -80,4 +80,4 @@ class DateFormatsSeeder extends Seeder
}
}
}
}
}