# SEO Date Handling Changes
## Migration
* rename publish_start_date -> first_published_at
* subtract 3 days from expired_at and rename to last_processed_at
## SEO Feed Generator
* don't calculate published_at (calculatedDatePosted in lensa-site) as it needs the "today" of request time for calculation
* save first_published_at instead to Dynamo
## SEO API
### First step
```plantuml
@startuml
if (last_processed_at present) then (yes)
:valid_through = last_processed_at + 3 days;
else (no)
if (first_published_at present) then (yes)
:valid_through = first_published_at + 30 days;
else (no)
:valid_through = 2018-05-02;
endif
endif
@enduml
```
### Second step
```plantuml
@startuml
if (first_published_at and valid_through present) then (yes)
:calculate published_at from min(today, valid_through);
else (no)
:published_at = None;
endif
@enduml
```
### Third step
```plantuml
@startuml
if (job is expired) then (yes)
if (valid_through present and is a valid date and is less then now) then (yes)
:valid_through unchanged;
else (no)
:valid_through = None;
endif
else (no)
if (published_at present and is a valid date) then (yes)
:valid_through = published_at + 30 days;
else (no)
:valid_through = None;
endif
endif
@enduml
```