Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision abde405d

Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt

Kosmetik: Einrückung verringern durch Shortcut

Unterschiede anzeigen:

SL/Locale.pm
277 277

  
278 278
  my ($self, $myconfig, $date, $longformat) = @_;
279 279

  
280
  if (!$date) {
281
    $main::lxdebug->leave_sub();
282
    return '';
283
  }
284

  
280 285
  my $longdate  = "";
281 286
  my $longmonth = ($longformat) ? 'LONG_MONTH' : 'SHORT_MONTH';
282 287

  
283 288
  my ($spc, $yy, $mm, $dd);
284 289

  
285
  if ($date) {
286

  
287 290
    # get separator
288
    $spc = $myconfig->{dateformat};
289
    $spc =~ s/\w//g;
290
    $spc = substr($spc, 1, 1);
291
  $spc = $myconfig->{dateformat};
292
  $spc =~ s/\w//g;
293
  $spc = substr($spc, 1, 1);
291 294

  
292
    if ($date =~ /\D/) {
293
      if ($myconfig->{dateformat} =~ /^yy/) {
294
        ($yy, $mm, $dd) = split /\D/, $date;
295
      }
296
      if ($myconfig->{dateformat} =~ /^mm/) {
297
        ($mm, $dd, $yy) = split /\D/, $date;
298
      }
299
      if ($myconfig->{dateformat} =~ /^dd/) {
300
        ($dd, $mm, $yy) = split /\D/, $date;
301
      }
302
    } else {
303
      $date = substr($date, 2);
304
      ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/);
295
  if ($date =~ /\D/) {
296
    if ($myconfig->{dateformat} =~ /^yy/) {
297
      ($yy, $mm, $dd) = split /\D/, $date;
298
    }
299
    if ($myconfig->{dateformat} =~ /^mm/) {
300
      ($mm, $dd, $yy) = split /\D/, $date;
305 301
    }
302
    if ($myconfig->{dateformat} =~ /^dd/) {
303
      ($dd, $mm, $yy) = split /\D/, $date;
304
    }
305
  } else {
306
    $date = substr($date, 2);
307
    ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/);
308
  }
306 309

  
307
    $dd *= 1;
308
    $mm--;
309
    $yy = ($yy < 70) ? $yy + 2000 : $yy;
310
    $yy = ($yy >= 70 && $yy <= 99) ? $yy + 1900 : $yy;
310
  $dd *= 1;
311
  $mm--;
312
  $yy = ($yy < 70) ? $yy + 2000 : $yy;
313
  $yy = ($yy >= 70 && $yy <= 99) ? $yy + 1900 : $yy;
311 314

  
312
    if ($myconfig->{dateformat} =~ /^dd/) {
313
      if (defined $longformat && $longformat == 0) {
314
        $mm++;
315
        $dd = "0$dd" if ($dd < 10);
316
        $mm = "0$mm" if ($mm < 10);
317
        $longdate = "$dd$spc$mm$spc$yy";
318
      } else {
319
        $longdate = "$dd";
320
        $longdate .= ($spc eq '.') ? ". " : " ";
321
        $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
322
      }
323
    } elsif ($myconfig->{dateformat} eq "yyyy-mm-dd") {
324

  
325
      # Use German syntax with the ISO date style "yyyy-mm-dd" because
326
      # Lx-Office is mainly used in Germany or German speaking countries.
327
      if (defined $longformat && $longformat == 0) {
328
        $mm++;
329
        $dd = "0$dd" if ($dd < 10);
330
        $mm = "0$mm" if ($mm < 10);
331
        $longdate = "$yy-$mm-$dd";
332
      } else {
333
        $longdate = "$dd. ";
334
        $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
335
      }
315
  if ($myconfig->{dateformat} =~ /^dd/) {
316
    if (defined $longformat && $longformat == 0) {
317
      $mm++;
318
      $dd = "0$dd" if ($dd < 10);
319
      $mm = "0$mm" if ($mm < 10);
320
      $longdate = "$dd$spc$mm$spc$yy";
336 321
    } else {
337
      if (defined $longformat && $longformat == 0) {
338
        $mm++;
339
        $dd = "0$dd" if ($dd < 10);
340
        $mm = "0$mm" if ($mm < 10);
341
        $longdate = "$mm$spc$dd$spc$yy";
342
      } else {
343
        $longdate = &text($self, $self->{$longmonth}[$mm]) . " $dd, $yy";
344
      }
322
      $longdate = "$dd";
323
      $longdate .= ($spc eq '.') ? ". " : " ";
324
      $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
325
    }
326
  } elsif ($myconfig->{dateformat} eq "yyyy-mm-dd") {
327

  
328
    # Use German syntax with the ISO date style "yyyy-mm-dd" because
329
    # Lx-Office is mainly used in Germany or German speaking countries.
330
    if (defined $longformat && $longformat == 0) {
331
      $mm++;
332
      $dd = "0$dd" if ($dd < 10);
333
      $mm = "0$mm" if ($mm < 10);
334
      $longdate = "$yy-$mm-$dd";
335
    } else {
336
      $longdate = "$dd. ";
337
      $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
338
    }
339
  } else {
340
    if (defined $longformat && $longformat == 0) {
341
      $mm++;
342
      $dd = "0$dd" if ($dd < 10);
343
      $mm = "0$mm" if ($mm < 10);
344
      $longdate = "$mm$spc$dd$spc$yy";
345
    } else {
346
      $longdate = &text($self, $self->{$longmonth}[$mm]) . " $dd, $yy";
345 347
    }
346

  
347 348
  }
348 349

  
349 350
  $main::lxdebug->leave_sub();

Auch abrufbar als: Unified diff